[mapguide-users] Draw Circle
A H
hizperion at hotmail.com
Sat Apr 4 16:45:30 EDT 2009
i've tried adding this to the code
polygon = (MgCurvePolygon)polygon.Transform(new MgCoordinateSystemTransform(coordSysFactory.Create(map.GetMapSRS()),coordSysFactory.Create(ll84Wkt)));
it seems like its not working too. i tried zooming out the map, and found the circle (it worked even without the code above).
i think i'm gonna have another problem with the circle shape.
i tried removing either one of the arcs in the code below, and it becomes the same dome shape.
hope anyone have a working code for this :(
In the GT markup example code (which is all PHP), the markupeditor.php file
contains the function I'm referring to. I'm assuming that is the code that
you started with for what you're doing.
function GetTransform()
{
$coordSysFactory = new MgCoordinateSystemFactory();
$resourceService =
$this->site->CreateService(MgServiceType::ResourceService);
$map = new MgMap();
$map->Open($resourceService, $this->args['MAPNAME']);
$source = $coordSysFactory->Create($map->GetMapSRS());
$target = $coordSysFactory->Create(MarkupManager::LL84WKT);
//return new MgCoordinateSystemTransform($source, $target);
return $coordSysFactory->GetTransform($source, $target);
}
Andy
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of A H
Sent: Saturday, April 04, 2009 12:44 PM
To: mapguide-users at lists.osgeo.org
Subject: RE: [mapguide-users] Draw Circle
i'm using MGOS 1.2, i think i can't find this GetTransform() function. can
you please provide the codes here? thank you in advance.
Looks like you have it all exactly correct (comparing it line by line to
some code I did awhile back, I started with the same sample code from this
list it looks like). The one thing you are missing is the following. It
should be between the curvePolygon abd byteReader lines:
curvePolygon = (MgCurvePolygon)curvePolygon.Transform(this.GetTransform());
Where GetTransform is a function you should already have defined in your
markupeditor file. I think your circle is being created and drawn, but not
in the correct coordinate system.
Andy Morsell, P.E.
Spatial Integrators, Inc.
www.SpatialGIS.com
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of A H
Sent: Friday, April 03, 2009 3:01 AM
To: mapguide-users at lists.osgeo.org
Subject: Re: [mapguide-users] Draw Circle
this is what i got. no error, but the circle didn't appear.
MgCurveSegmentCollection curveSegmentCollection = new
MgCurveSegmentCollection();
MgCurveRingCollection curveRingCollection = new
MgCurveRingCollection();
// create first curve segment for the external boundary
MgCoordinate startCoordinate =
geometryFactory.CreateCoordinateXY(X1 - rad, Y1);
MgCoordinate controlCoordinate =
geometryFactory.CreateCoordinateXY(X1, Y1 + rad);
MgCoordinate endCoordinate =
geometryFactory.CreateCoordinateXY(X1 + rad, Y1);
MgArcSegment arcSegment =
geometryFactory.CreateArcSegment(startCoordinate, endCoordinate,
controlCoordinate);
curveSegmentCollection.Add(arcSegment);
// create second curve segment for the external boundary
MgCoordinate startCoordinate2 =
geometryFactory.CreateCoordinateXY(X1 + rad, Y1);
MgCoordinate controlCoordinate2 =
geometryFactory.CreateCoordinateXY(X1, Y1 - rad);
MgCoordinate endCoordinate2 =
geometryFactory.CreateCoordinateXY(X1 - rad, Y1);
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 polygon =
geometryFactory.CreateCurvePolygon(exteriorCurveRing, null);
MgByteReader geom = geometryReaderWriter.Write(polygon);
properties.Add(new MgGeometryProperty("GEOM", geom));
i need help with this too.
Hi Kencana,
I remember u telling me that you have figured out how to draw a circle.
Could you please give me some tips on this? For example, in the
OnCircleDigitized(Circle) method, what all attributes do we need to get from
the circle and using what methods? I couldn't find any help on this...:-(
So far, all I have got is:
function OnCircleDigitized(Circle)
{
var radius = Circle.Radius;
}
Also, how do u create the circle on the server side using the method:
CreateCurvePolygon?
Thanks and regards
Farah
-----Original Message-----
From: kencana kesuma [mailto:bluesky_dyx at hotmail.com]
Sent: Monday, December 04, 2006 1:25 PM
To: farah at egovernments.org
Subject: RE: polygon color
Hi Farah,
I guess I have figure out how to draw the circle already.
instead of using CreatePolygon command,
I used CreateCurvePolygon to draw the circle.
I defined 2 arc lat long position and it works.
Anyway, thank you very much.
Without your references, I guess I am not able to do it.
once again thank you.
Regards,
Kencana
--
View this message in context: http://n2.nabble.com/Draw-Circle-tp1809757p2586379.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list