[mapguide-users] Unable to select polygon?!?

Ivan Milicevic Ivan.Milicevic at supranet.hr
Tue Mar 31 14:05:48 EDT 2009


Kori, you're the man! 

 

That's it!

 

From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Kori Maleski
Sent: Tuesday, March 31, 2009 6:18 PM
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] Unable to select polygon?!?

 

Ivan,

 

When I view the Polygons in Autocad Map - there is a an issue with the left polygon:

 

It is not 'closed' properly.  When you select the right polygon it is entirely highlighted.  When you select the left polygon, the left boundary segement does not highlight (since it is not there).

 

You may have to add the starting coordinate to close it:

 

coords.Add(geometryFactory.CreateCoordinateXY(x - 50, y + 50));
coords.Add(geometryFactory.CreateCoordinateXY(x + 50, y + 50));
coords.Add(geometryFactory.CreateCoordinateXY(x + 50, y - 50));
coords.Add(geometryFactory.CreateCoordinateXY(x - 50, y - 50));
coords.Add(geometryFactory.CreateCoordinateXY(x - 50, y + 50));

 

Cheers,


 

2009/3/31 Ivan Milicevic <Ivan.Milicevic at supranet.hr>

Hello,

 

I have strange problem :)

 

-2 polygon features in SDF file (left and right) -I can not select left feature -I can select right feature

 

In Map 3D 2010 everything looks ok. In FDO Tools, SDF looks just fine. The difference between those features is that left one is created from web code and right one is created from Map 3D.

 

Any idea?

 

The link below is link to sdf file:

http://www.supranet.hr/downloads/sdf.zip

 

and down there is code that I used to create polygon:

 

.......main function......

{

//adding coord to MgCoordinateCollection

coords.Add(geometryFactory.CreateCoordinateXY(x - 50, y + 50));

coords.Add(geometryFactory.CreateCoordinateXY(x + 50, y + 50));

coords.Add(geometryFactory.CreateCoordinateXY(x + 50, y - 50));

coords.Add(geometryFactory.CreateCoordinateXY(x - 50, y - 50));

 

//creating polygon

MgPolygon polyObjekt = createPolygon();

byteReader = agfReaderWriter.Write(polyObjekt);

 

//defining properties in MgPropertyCollection

fillProperties(id, napomena, naziv, oznaka, 1, byteReader);

 

//inserting in SDF

insertOnMap();

}

 

public MgPolygon createPolygon()

{

MgLinearRing mgRing = geometryFactory.CreateLinearRing(coords);

MgLinearRingCollection mgRingCollection = new MgLinearRingCollection();

mgRingCollection.Add(mgRing);

 

MgPolygon mgPoly = geometryFactory.CreatePolygon(mgRing, null);

return mgPoly;

}

 

public void fillProperties(Int32 ID, string napomena, string naziv, string oznaka, Int32 vrstaObjekta, MgByteReader bReader)

{

properties.Clear();

properties.Add(new MgInt32Property("ID", ID));

properties.Add(new MgStringProperty("NAPOMENA", napomena));

properties.Add(new MgStringProperty("NAZIV", naziv));

properties.Add(new MgStringProperty("OZNAKA", oznaka));

properties.Add(new MgInt32Property("VRSTAOBJEKTA", vrstaObjekta));

properties.Add(new MgGeometryProperty("Geom", bReader));

}

 

public void insertOnMap()

{

MgSiteConnection siteConnection = null;

MgUserInformation userInfo = new MgUserInformation(mgSessionId);

siteConnection = new MgSiteConnection();

siteConnection.Open(userInfo);

MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;

MgFeatureService featureService = siteConnection.CreateService(MgServiceType.FeatureService) as MgFeatureService;

MgResourceIdentifier resId = new MgResourceIdentifier("Library://PROJEKTI/ZLZ/PODACI/OBJEKTI.FeatureSource");

MgFeatureCommandCollection commands = new MgFeatureCommandCollection();

string layerClassName = "OBJEKTI";

MgInsertFeatures mgInsert = new MgInsertFeatures(layerClassName, properties);

commands.Add(mgInsert);

featureService.UpdateFeatures(resId, commands, false);

}"

 

 

Ivan Miličević

voditelj odjela razvoja

 

SUPRA NET d.o.o.
Majstorska 5, 10000 Zagreb
CROATIA

Mobile: +385 (0)91 434-3940
Office: +385 (0)1 434-3940
Fax: +385 (0)1 434-3999
Email: ivan.milicevic at supranet.hr

URL: www.supranet.hr <http://www.supranet.hr/> 

 


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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090331/1cb5699d/attachment.html


More information about the mapguide-users mailing list