[mapguide-users] MgCurvePolygon
Mbonnet
mbonnet at adelior.gfi.fr
Fri Jul 6 09:24:00 EDT 2007
Hi,
I try to add a MgCurvePolygon but nothing appears, and i have no error
message. i give you my code
MgGeometryFactory geometryFactory = new MgGeometryFactory();
MgWktReaderWriter wktWriter = new MgWktReaderWriter();
MgAgfReaderWriter agfWriter = new MgAgfReaderWriter();
String[] vertices = null;
vertices = ((String)this.args.get("GEOMETRY")).split(",");
double rayon = Double.parseDouble(vertices[0]);
double centreX = Double.parseDouble(vertices[1]);
double centreY = Double.parseDouble(vertices[2]);
MgCurveSegmentCollection curveSegmentCollection = new
MgCurveSegmentCollection();
MgCurveRingCollection curveRingCollection = new MgCurveRingCollection();
// create first curve segment for the external boundary
MgCoordinate startCoordinate = geometryFactory.CreateCoordinateXY(centreX -
rayon ,centreY);
MgCoordinate controlCoordinate = geometryFactory.CreateCoordinateXY(centreX,
centreY + rayon);
MgCoordinate endCoordinate = geometryFactory.CreateCoordinateXY(centreX +
rayon , centreY);
MgArcSegment arcSegment = geometryFactory.CreateArcSegment(startCoordinate,
endCoordinate, controlCoordinate);
curveSegmentCollection.Add(arcSegment);
// create second curve segment for the external boundary
MgCoordinate startCoordinate2 = geometryFactory.CreateCoordinateXY(centreX +
rayon , centreY);
MgCoordinate controlCoordinate2 =
geometryFactory.CreateCoordinateXY(centreX, centreY - rayon);
MgCoordinate endCoordinate2 = geometryFactory.CreateCoordinateXY(centreX -
rayon ,centreY);
MgArcSegment arcSegment2 = geometryFactory.CreateArcSegment(startCoordinate,
endCoordinate, controlCoordinate);
curveSegmentCollection.Add(arcSegment2);
// create curve ring for the external boundary
MgCurveRing exteriorCurveRing =
geometryFactory.CreateCurveRing(curveSegmentCollection);
// create curve polygon
MgCurvePolygon curvePolygon =
geometryFactory.CreateCurvePolygon(exteriorCurveRing, null);
curvePolygon = (MgCurvePolygon)curvePolygon.Transform(this.GetTransform());
// print out the Agf Text string for the geometry
MgByteReader byteReader = agfWriter.Write(curvePolygon);
MgPropertyCollection propertyValues = new MgPropertyCollection();
propertyValues.Add(new MgStringProperty("Text",
(String)this.args.get("TEXT")));
propertyValues.Add(new MgGeometryProperty("Geometry", byteReader));
this.InsertDessinFeature(propertyValues);
function : InsertDessinFeature
MgFeatureService featureService =
(MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
MgResourceIdentifier featureSourceId = new
MgResourceIdentifier("Library://Dessins/" + this.GetDessinName() +
".FeatureSource");
MgFeatureCommandCollection commands = new MgFeatureCommandCollection();
commands.Add(new MgInsertFeatures("Dessins", propertyValues));
featureService.UpdateFeatures(featureSourceId, commands, false);
please help me.
--
View this message in context: http://www.nabble.com/MgCurvePolygon-tf4035479s16610.html#a11464280
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list