Selection on Compact Framework

Topics: General Topics
May 2, 2007 at 9:47 AM
Hi everybody
I'm using SharpMapMobile to develop an application on PPC 2003 with the .Net 2.0 Compact Framework.
When I want to select an object on the map, I have the following error
NotSupportedException

Is there anyone have the same error ? How can I solve it ?
Is there another version of SharpMap supporting the .Net 2.0 Compact Framework than Sharpmapmobile.zip on PocketTerra Website ?

Thanks for help !
May 2, 2007 at 10:48 AM
Hi.

I think there is no much people working on Compact Framework because I allways ask about it and only one or two people answer.

For the first question, look at the place that it's throw and put a try catch to manage it.

I only found that version of Sharpmap for Pocket Pc. I'm trying to upgrage it to the last version of .Net Framework but I didn't time to do it.

If you have more questions ask me. Maybe we can work together in the Compact Framework port.

Good bye!
May 21, 2007 at 3:20 AM
Hi saispasfau:

I select an object on the when the user click over it, I write some functions to get the values from this select object(an info tool).

This is my code:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/// <summary>
/// This method get the info on only one layer under the point
/// </summary>
/// <param name="pmapMap"></param>
/// <param name="ppntPoint"></param>
/// <returns></returns>
private ArrayList GetInfoFeatures(Map pmapMap, SharpMap.Geometries.Point ppntPoint, int intPositionLayer, double pdblFactor)
{
ArrayList arlResult = new ArrayList();
try
{

SharpMap.Layers.VectorLayer lyrMyLayer = (SharpMap.Layers.VectorLayer) pMapMap.LayersintPositionLayer;//get the layer
SharpMap.Data.FeatureDataSet fds = new SharpMap.Data.FeatureDataSet();//Where the features will be stored
SharpMap.Geometries.Point pntPoint2 = new SharpMap.Geometries.Point(ppntPoint.X + pdblFactor, ppntPoint.Y + pdblFactor);//The second point in the square
SharpMap.Geometries.BoundingBox bubBoundingBox = new SharpMap.Geometries.BoundingBox(ppntPoint, pntPoint2);//Doing the area to search
lyrMyLayer.DataSource.ExecuteIntersectionQuery(bubBoundingBox, fds);//Seaching the features under the square
if (fds.Tables.Count > 0)//If al least one feature where founded
{
foreach (SharpMap.Data.FeatureDataRow feature in fds.Tables0)//Getting all the features
{

arlResult.Add(GetInfoFeature(feature)); //Getting all the data from one by one feature, the column name and the value
}
}
lyrMyLayer.DataSource.Close();
}
catch (Exception Ex)
{
return null;
}


return arlResult;
}

/// <summary>
/// This method return all the data of the feature, the column name and the value
/// </summary>
/// <param name="pmapMap"></param>
/// <param name="ppntPoint"></param>
/// <returns></returns>
private ArrayList GetInfoFeature(SharpMap.Data.FeatureDataRow feature)
{
ArrayList arlResult = new ArrayList();
try
{
foreach (System.Data.DataColumn ColColumn in feature.Table.Columns)
{
ArrayList arlDataColumn =new ArrayList();//A new array list
arlDataColumn.Add(ColColumn.ColumnName);//The column name
arlDataColumn.Add(featureColColumn.ColumnName.ToString()); //The value of the column
arlResult.Add(arlDataColumn); //The data of the column
}
return arlResult;//All the data of the feature

}
catch (Exception Ex)
{
return null;
}

return arlResult;
}


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The function returns an ArrayList with two arraylist: 1,-The column name 2.- The value of this column


May be my code is not the better code but i will still improve it, by the moment it works, i hope that this code is useful for your problem.

See you later.

Coordinator
Jun 19, 2007 at 9:50 AM
It's true. None of the developers of SharpMap are currently working on a Compact Framework port. If you are serious about doing it, though, let me know, since I would like to see how SharpMap could accomodate it as it evolves.