[mapguide-users] c#.Net displaying problem
Jackie C. Ng
jumpinjackie at gmail.com
Tue Sep 30 07:57:08 EDT 2008
MgFeatureProperty is for object properties (ie. You have a feature class that
has another nested class definition)
As for the process of adding points. It basically is
1. Create your feature source
1.1 Create a feature class definition for the feature source
1.2 Add any properties to the feature class
1.3 Set the geometry type of the feature class to points
1.4 Save this to a session resource.
1.5 Set the spatial context equal to the SRS of the current MgMap, otherwise
the points you insert may not be where you think they are.
2. Create a layer definition that references the created feature source
2.1 Create or load the xml content for this layer definition
2.2 Save this to a session resource.
3. Create an MgInsertFeatures command
3.1 Set the first parameter className = name of your created feature class
3.2 Create a property collection
3.2.1 Fill the property collection with the values you want to insert. Each
value corresponds to a property in your feature class.
3.2.2 For the point feature, insert a MgGeometryProperty object. As a
MgGeometryProperty requires a MgByteReader for the geometry value, use a
MgGeometryFactory to create your MgGeometry object and convert it to a
MgByteReader with a MgAgfReaderWriter instance.
3.3 Add this MgInsertFeatures command to your MgFeatureCommandCollection
3.4 Finally, pass this MgFeatureCommandCollection to the UpdateFeatures()
method of your MgFeatureService. Also give it the resource id of the feature
source you created.
3.5 You may need to close any open MgFeatureReaders in the result of
UpdateFeatures(), this is what the code you posted is trying to do.
4. Finally refresh the map on the client side (manual or programmatically)
and the point should be there.
That's a high level overview of it all. There may be a few bits that are
slightly incorrect, but that is the general process flow.
- Jackie
coderogue wrote:
>
> Hi,
>
> I'm colleague of viva_rose... and I've looked into the code. But I'm not
> familiar with GIS programming. However, I've been tracing her code and
> found that there's no property found in the function below... But it was
> set to insert some properties earlier.. wonder what does the
> MgFeatureProperty use for?
>
> Besides, may i have a simple explaination of how does the point display to
> the web? as viva is taking leave on these days. Hope you can understand
> my question. Thanks
>
> void ReleaseReader(MgPropertyCollection res, MgFeatureCommandCollection
> commands)
> {
> if (res == null)
> {
> return;
> }
>
> for (int i = 0; i < res.GetCount(); i++)
> {
> MgFeatureCommand cmd = commands.GetItem(i);
> if (cmd is MgInsertFeatures)
> {
> MgFeatureProperty resProp = res.GetItem(i) as
> MgFeatureProperty;
> if (resProp != null)
> {
> MgFeatureReader reader = resProp.GetValue() as
> MgFeatureReader;
> if (reader == null)
> return;
> reader.Close();
> }
>
>
-----
http://themapguyde.blogspot.com
http://www.linkedin.com/in/jackieng
--
View this message in context: http://www.nabble.com/c-.Net-displaying-problem-tp19664218p19740623.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list