[mapguide-users] Draw Circle

Andy Morsell amorsell at spatialgis.com
Sat Apr 4 15:53:40 EDT 2009


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


>From: "Farah" <farah at egovernments.org>
>To: "'kencana kesuma'" <bluesky_dyx at hotmail.com>
>Subject: RE: polygon color
>Date: Mon, 4 Dec 2006 13:12:51 +0530
>
>Hi Kencana..
>
>
>I don't know about this..i havent tried it...
>I will pass on any info that I get on this..if I do..!! :-)
>
>
>
>farah
>
>-----Original Message-----
>From: kencana kesuma [mailto:bluesky_dyx at hotmail.com]
>Sent: Monday, December 04, 2006 11:51 AM
>To: farah at egovernments.org
>Subject: RE: polygon color
>
>Hi,
>
>I mean,
>can we draw circle other than drawing polygon?
>I was wondering is there any API for drawing circle on the map.
>Thank you.
>
>Regards,
>Kencana
>
>
> >From: "Farah" <farah at egovernments.org>
> >To: "'kencana kesuma'" <bluesky_dyx at hotmail.com>
> >Subject: RE: polygon color
> >Date: Mon, 4 Dec 2006 11:52:02 +0530
> >
> >Hi...
> >
> >Ur welcome!
> >Im sorry....i didn't get u..!  Which circle?
> >
> >Regards
> >Farah
> >
> >-----Original Message-----
> >From: kencana kesuma [mailto:bluesky_dyx at hotmail.com]
> >Sent: Monday, December 04, 2006 11:45 AM
> >To: farah at egovernments.org
> >Subject: RE: polygon color
> >
> >Hi Farah,
> >
> >Thank you very much for the reply...
> >It helps.:):):)
> >
> >Anyway,
> >We use CreatePolygon for drawing the polygon
> >any idea for the circle?
> >Sorry for keep distrubing you
> >Please don't mind...
> >
> >Thank you very much
> >
> >Regards,
> >Kencana
> >
> >
> > >From: "Farah" <farah at egovernments.org>
> > >To: "'kencana kesuma'" <bluesky_dyx at hotmail.com>
> > >CC: <users at mapguide.osgeo.org>
> > >Subject: RE: polygon color
> > >Date: Mon, 4 Dec 2006 11:31:34 +0530
> > >
> > >Hi Kencana,
> > >
> > >In the studio, when you are giving a style to a particular scale range:
> > >for
> > >a layer, we have an option to set the transparency ( from 0 to 100: 0
> >means
> > >not transaprent and as you go towards 100, the transparency increases 
>and
> > >the colour changes accordingly!). Now if you save this layer as xml,you
> > >will
> > >get the required styling info and colour.
> > >
> > >For example:
> > >
> > ><AreaSymbolization2D>
> > >	<Fill>
> > >		<FillPattern>Solid</FillPattern>
> > >		<ForegroundColor>80800000</ForegroundColor>
> > >		<BackgroundColor>FF000000</BackgroundColor>
> > >	</Fill>
> > >  	<Stroke>
> > >		<LineStyle>Solid</LineStyle>
> > >		<Thickness>0.0</Thickness>
> > >		<Color>FFC0C0C0</Color>
> > >		<Unit>Centimeters</Unit>
> > >	</Stroke>
> > ></AreaSymbolization2D>
> > >
> > >
> > >
> > >
> > >This colours: forground: 80800000 and background: FF000000 give a
> >slightly
> > >transparent red shade to the polygon.
> > >
> > >
> > >Regards
> > >Farah
> > >
> > >
> > >-----Original Message-----
> > >From: kencana kesuma [mailto:bluesky_dyx at hotmail.com]
> > >Sent: Monday, December 04, 2006 9:43 AM
> > >To: farah at egovernments.org
> > >Subject: polygon color
> > >
> > >Hi Farah,
> > >
> > >Do you know how to make the polygon bg color transparent?
> > >so that only the polygon fill and the outline layer can be seen?
> > >
> > >Hope you can help me out
> > >
> > >Regards,
> > >Kencana
> > >
> > >_________________________________________________________________
> > >Express yourself instantly with MSN Messenger! Download today it's 
>FREE!
> > >http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> > >
> >
> >_________________________________________________________________
> >Express yourself instantly with MSN Messenger! Download today it's FREE!
> >http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >
>
>_________________________________________________________________
>Don't just search. Find. Check out the new MSN Search!
>http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Disclaimer by Mail Administrator - Yukthi
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users





-- 
View this message in context:
http://n2.nabble.com/Draw-Circle-tp1809757p2579805.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users



-- 
View this message in context:
http://n2.nabble.com/Draw-Circle-tp1809757p2586172.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users




More information about the mapguide-users mailing list