Skip to content

Commit

Permalink
初步实现Modify的功能。
Browse files Browse the repository at this point in the history
  • Loading branch information
marsprj committed Dec 1, 2016
1 parent 59ef75c commit 8a4799e
Show file tree
Hide file tree
Showing 4 changed files with 547 additions and 129 deletions.
48 changes: 33 additions & 15 deletions example/all/interaction/interaction_modify.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
<body onload="init()">
<button onclick="onRefresh()">refresh</button>
<button onclick="onRed()">red</button>
<input type="text" size="30" id="xy">
<div id="mapDiv" style="height:800px;width:100%;position:absolute;top:80px;"></div>
</body>

Expand Down Expand Up @@ -172,26 +173,36 @@
opacity : 1.0,
visible : true
}),
// new GeoBeans.Layer.FeatureLayer({
// name : "cities",
// geometryType : GeoBeans.Geometry.Type.POINT,
// source : new GeoBeans.Source.Feature.GeoJSON({
// url : "../data/geojson/points-5.json",
// geometryName : "geometry",
// }),
// visible : true,
// style : createPicPointStyle()
// }),
// new GeoBeans.Layer.FeatureLayer({
// name : "cities",
// geometryType : GeoBeans.Geometry.Type.LINESTRING,
// source : new GeoBeans.Source.Feature.GeoJSON({
// url : "../data/geojson/lines-3.json",
// geometryName : "geometry",
// }),
// visible : true,
// //style : createPicPointStyle()
// }),
new GeoBeans.Layer.FeatureLayer({
name : "cities",
geometryType : GeoBeans.Geometry.Type.LINESTRING,
geometryType : GeoBeans.Geometry.Type.POLYGON,
source : new GeoBeans.Source.Feature.GeoJSON({
url : "../data/geojson/lines-3.json",
url : "../data/geojson/world.geojson",
geometryName : "geometry",
}),
visible : true,
//style : createPicPointStyle()
}),
// new GeoBeans.Layer.FeatureLayer({
// name : "country",
// geometryType : GeoBeans.Geometry.Type.POLYGON,
// source : new GeoBeans.Source.Feature.GeoJSON({
// url : "../data/geojson/world.geojson",
// geometryName : "geometry",
// }),
// visible : true,
// style : createSimplePolygonStyle()
// })
style : createSimplePolygonStyle()
})
],
viewer : {
// center : new GeoBeans.Geometry.Point(0,0),
Expand All @@ -203,6 +214,7 @@
});

targetLayer = mapObj.getLayer("cities");
mapObj.on(GeoBeans.Event.MOUSE_MOVE, onMouseMove);

createInteractions();
}
Expand All @@ -226,6 +238,7 @@
}

function onSelectionChange(features){
modify.setFeatures(features);
console.log(modify.getFeatures().length);
}

Expand Down Expand Up @@ -269,7 +282,7 @@
var symbol = new GeoBeans.Style.Symbol();

// 5、设置图片的路径
symbol.icon = "../../images/circle.png";
symbol.icon = "../images/circle.png";

// 6、图片的大小,如果不设定则为图片本身的大小
symbol.icon_width = 16;
Expand Down Expand Up @@ -388,6 +401,11 @@
}
}
}

function onMouseMove(evt){
var str = evt.mapX + ", " + evt.mapY;
document.getElementById("xy").value = str;
}

</script>

Expand Down
4 changes: 4 additions & 0 deletions src/GeoBeans/Geometry/Point.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,7 @@ GeoBeans.Geometry.Point.prototype.distance = function(geometry){
}
return null;
}

GeoBeans.Geometry.Point.prototype.clone = function(){
return (new GeoBeans.Geometry.Point(this.x, this.y));
}
Loading

0 comments on commit 8a4799e

Please sign in to comment.