show and move icons , ... !
Hello
Mike
1- how we can show and move icons (16 or 256 or ... colors) in custom layers (e.g. with mouse drag) ?
2- how to match some custom layers (position) over one fix layer ?
3- how to save all custom layers that are loaded over one fix layer ?
(i want when user open this fix layer file other custom layers will be opend with it)
please explain more about these :
4- Packaging ?
5- Projects ?
6- Map Catalogs ?
7- how to get Dutom and Projection types strings ? (is any function ?)
8- is any Database managing functions ?
Best regards
Thanks a lot.
Mike
1- how we can show and move icons (16 or 256 or ... colors) in custom layers (e.g. with mouse drag) ?
2- how to match some custom layers (position) over one fix layer ?
3- how to save all custom layers that are loaded over one fix layer ?
(i want when user open this fix layer file other custom layers will be opend with it)
please explain more about these :
4- Packaging ?
5- Projects ?
6- Map Catalogs ?
7- how to get Dutom and Projection types strings ? (is any function ?)
8- is any Database managing functions ?
Best regards
Thanks a lot.
Comments
-
You can use the GM_AddCustomSymbol function to add your own custom symbols, then use the GM_SetPointFeaturePosition to move the location of an existing point feature. You can use the GM_SetPointFeatureDrawStyle function to change the symbol used for an existing point feature.
You can use the GM_RepositionLayer function to reposition a loaded layer based on a list of control points.
If you export a Global Mapper package file (GM_ExportPackage) then each separate layer will be saved in the file and be recoverable as separate layers upon load of the package file.
I'm not sure what you mean about 'projects', did you mean projections? A map catalog is something to manage large collections of file efficiently. The map catalog will automatically manage loading and unloading files referenced from the map catalog as needed for display and export.
You can use the GM_GetAvailableProjectionList function to get a list of all projections, their supported datums, and the names of both.
There are not any build-in functions for managing a live database connection.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hello
Dear Mike
GM_ExportPackage is a good one for saving opend layers (rasters and vectors ...)
but it takes a much disk space for saving package file !
Managing these like Global Mapper App. in "Workspace" is better but i dont find workspace files extention (*.gmw) in "commenly supported files ' formats !
Can i simulate like that ?
(i want save layers and other information such as Projection and Path of other layers and ... in it .)
please explain more about Workspace .
thanks alot. -
There is not currently any support for saving or loading workspace files from the SDK. You could certainly create your own kind of format for saving metadata information like this. We may also eventually add workspace support to the SDK.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hello Mike
GOD Speed
I want export many of areas on one layer.
but are some problems when open this layer again :
1- in shape format must load only one type of features ?
2- in dxf format inside of Areas are clear (only area around lines are exported)?
3- in Kmz and Mif and Shp and Dxf formats transparency dosnt exported ?
Thanks a lot. -
The Shapefile format is limited to either all areas, all lines, or all points. You cannot mix Shape types in a single Shapefile (this is a format limitation and not a Global Mapper limitation).
The DXF format is not really great for mapping formats. It is not typically clear whether area features (actually just lines with a closed flag set) should be filled or not, so when loading DXF files Global Mapper just goes the safe route and does not fill them.
In any format all that will be exported for an area is the border of the area, it is the drawing style that controls whether or not it is filled. With the SDK you could change this by simply looping through the areas loaded from a DXF file and calling GM_SetAreaFeatureDrawStyle to change the drawing style to be filled if you wanted.
The only format that explicitly supports translucent (i.e. partially transparent) areas is the KML/KMZ format. Any areas that are marked as partially transparent should export that way to new KML/KMZ format files. The other formats either don't support styling at all (i.e. Shapefiles and DXF to some extent) or don't support translucency.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hi,
I understand that we can use GM_AddCustomSymbol to add our own symbol. I use GM_SetPointFeatureClassDrawStyle(PFC_SYMBOL, &symbolsyle) to create a new point feature class for my custom layer. I have also added PFC_SYMBOL into the FeatureClass.h of the GlobalMapperInterface as well.
However, when I added the custom symbol in my overlay, it only shows up as a black dot and not the icon file that I wanted. Is there any steps I may have missed?
Thanks in advance. -
To add your own custom type you need to use the GM_AddCustomPointClass function. Just adding a new enumeration to FeatureClass.h won't do anything as the SDK library won't know anything about it.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Oh. I think I am still using the v1.24 SDK. I think I will download the latest SDK to test.
Thanks for the prompt reply. -
Hi,
I have another question. Is it possible to set an orientation for a custom symbol ?
Example, in a given overlay, each of the symbols has a different orientation with respect to the map.
Thanks in advance -
While it is not currently possible to rotate an individual symbol, this is something that I plan to work on very shortly (this week in fact).
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hi,
I seem to be having a problem in displaying symbol label on the overlay.
I have created a new GM_PointFeature_t and initialise the name and class for its feature info. I have set mDraw and mDrawAlways to true, and also make sure that the aDrawFlag does not have GM_DrawFlags_HideLabels. If I am right, I should be able to see a label display next to the custom symbol on screen. The custom symbol did show up on the overlay but not its label.
I have also tried using GM_SetFeatureLabel to add in a label name for the custom symbol. However, the label is still not shown.
Is there any step that I have not done?
Thanks in advance. -
A display label is always associated with a particular feature, not the symbol used for a feature. The symbol used for a feature only has a name for displaying a symbol selection list. The symbol name is never displayed on the map.
The call to GM_SetFeatureLabel should work to set the display label for a feature. Exactly how are you calling it?
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Here is a code snippet of my application.
const GM_LayerInfo_t* layer_info = GM_GetLayerInfo(overlay);
int index = layer_info->mNumPoints;
GM_PointFeature_t newPoint;
newPoint.mFeatureInfo.mName = "TEST";
newPoint.mFeatureInfo.mDesc = NULL;
newPoint.mFeatureInfo.mClass = PFC_1ST_AID;
newPoint.mPos.mX = longitude;
newPoint.mPos.mY = latitude;
GM_Error_t32 theErr = GM_AddPointToVectorLayer(overlay, &newPoint, TRUE);
The above code shoiuld display a 1st Aid symbol on the overlay. However, the label was not visible.
As for GM_SetFeatureLabel, this was how I used it.
GM_SetFeatureLabel(overlay, GM_FeatureClass_Point, index, "TEST_LABEL");
This function was called during the creation of the new feature that was required in my application. -
Your code basically, looks ok, although I would add the line:
memset( &newPoint, 0, sizeof newPoint );
After your declare your 'newPoint' object, otherwise the members that you don't initialize will be filled with garbage and could cause problems.
Other than that, your specification of the display label looks correct, so I'm wondering if the style is the problem. You might call the GM_GetPointFeatureClassDrawStyle function for the PFC_1ST_AID type and verify that mDrawLabel is set for the type. You could also check the mFont value to check the font color and size. You'll want to make sure that your font color isn't the same as the background color of your map otherwise it will be impossible to see the text when it is drawn on the background.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hi, I finally got the label display properly on my overlay.
I added the GM_SetRegistryKey("test_app") during the initialisation of the code.
Although I am still not sure why this will affect the label display.
Thanks. -
By default any SDK-based application shares its settings with the installed Global Mapper settings, so you must have disabled label display in Global Mapper. When you call GM_SetRegistryKey you specify that you want to use your own individual settings, so you then start out with the default settings for everything, meaning that label display was then enabled.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hi Mike,
I am able to add and reposit, to a vector layer (S57), a new point feature (PFC_1st_aid) with a label. In order to succeed that i perform the followings:
1. i get the number of point features
2. So in the next available index, i addpointtovectorlayer
3. setfeaturelabel
4. finally refresh the panel and everything is ok.
The problem is that when i try to add a new icon point feature (figther.ico) with a label (f16), the icon is displayed correctly but the label is not displayed.
i do the followings:
1. i get the number of point features
2. addcustomsymbol
3. in the next available index, i addpointtovectorlayer
4. setpointfeaturedrawstyle
5. setfeaturelabel
6. refresh the panel
no error is reported back.
Do i have to do anything else? what is your advise.
Thanks again.
Update:
Problem solved by using the
getpointfeature function and copying the returned mpointstyle to the setpointfeaturestyle function. -
You might also note that you don't need to call the GM_SetFeatureLabel function, you can just provide the display label as part of the GM_PointFeature_t structure that you provide to the GM_AddPointToVectorLayer function.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hi,
I am adding and removing points but i face a problem with the feature index.
For adding i am using GM_AddPointToVectorLayer().
For deletion i am using GM_DeleteFeature()
1. add point (index = 0)
2. add point (index = 1)
3. delete first point (index = 0)
problem come after this, what is index of the next point?
0? or 2 ?
4. add point (index = 2?)
thanks! -
When you delete a feature it doesn't actually remove the feature from memory, it just marks it as deleted. So your point at index 0 still exists after deleting it, it is just marked as deleted and won't be drawn or exported. So when you add a new point its index will be 2.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hi Mike,
I am having problems calling this API GM_AddPointToVectorLayer from C# to add some points (with custom symbols *.ICO)
It throws an AccessViolationException - Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I am stuck on this for a few days now, search the net, found out that it may be due to marshallling problems.
Mike do you know what is wrong and can you show me the easiest way to add a point ?
Greatly Appreciate your help, Mike !
Here is my C# code
C# structs:
[StructLayout(LayoutKind.Sequential)]
public struct GM_PointFeature_t
{
public GM_VectorFeature_t mFeatureInfo; // General feature info
public GM_Point_t mPos; // Location of the point (global coordinates when getting, native when adding feature)
public GM_PointStyle_t mPointStyle; // Point render style (symbol and font)
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct GM_VectorFeature_t
{
[MarshalAs(UnmanagedType.LPStr)]
public String mName; // Name of the feature
[MarshalAs(UnmanagedType.LPStr)]
public String mDesc; // Description of the feature
public UInt16 mClass;
public IntPtr mAttrList; // List of attributes associated with feature
public UInt16 mNumAttrs; // Number of attributes in mAttrList
}
[StructLayout(LayoutKind.Sequential)]
public struct GM_Point_t
{
public double longitude;
public double latitude;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct GM_PointStyle_t
{
[MarshalAs(UnmanagedType.LPStr)]
public String mSymbolName; // name of symbol
public GM_FontDef_t mFont; // font to use to render label
public byte mDrawLabel; // boolean render the label for this point if there is one
public byte mDrawLabelAlways; // boolean render the label for this point even if it collides with another display label
}
C# calling code:
{
// add a symbol for this point
LastGMError = GlobalMapperDLL.GM_AddCustomSymbol(Marshal.StringToHGlobalAnsi(SymbolFilePath), Marshal.StringToHGlobalAnsi(SymbolName));
IntPtr currentLayer = (IntPtr)clsGlobalVARS.LayerHandles[0];
GM_PointFeature_t gm_PointFeature_t = new GM_PointFeature_t();
gm_PointFeature_t.mFeatureInfo.mName = SymbolName;
gm_PointFeature_t.mFeatureInfo.mDesc = String.Empty;
gm_PointFeature_t.mFeatureInfo.mClass = (ushort)GM_FeatureClassType_t8.GM_FeatureClass_Point;
GM_AttrValue_t gm_AttrValue_t;
gm_AttrValue_t.mName = SymbolName;
gm_AttrValue_t.mVal = String.Empty;
IntPtr mAttrListPtr = Marshal.AllocHGlobal(Marshal.SizeOf(gm_AttrValue_t));
Marshal.StructureToPtr(gm_AttrValue_t, mAttrListPtr, true);
gm_PointFeature_t.mFeatureInfo.mAttrList = mAttrListPtr;
gm_PointFeature_t.mFeatureInfo.mNumAttrs = (UInt16)0;
gm_PointFeature_t.mPos.latitude = 5000;
gm_PointFeature_t.mPos.longitude = 5000;
gm_PointFeature_t.mPointStyle.mSymbolName = SymbolName;
gm_PointFeature_t.mPointStyle.mDrawLabel = 0;
gm_PointFeature_t.mPointStyle.mDrawLabelAlways = 0;
gm_PointFeature_t.mPointStyle.mFont.mBgMode = 0;
gm_PointFeature_t.mPointStyle.mFont.mCharset = 0;
gm_PointFeature_t.mPointStyle.mFont.mColor = (uint)0;
gm_PointFeature_t.mPointStyle.mFont.mFaceName = String.Empty;
// EXCEPTION RAISED AT THIS LINE //
LastGMError = GlobalMapperDLL.GM_AddPointToVectorLayer(currentLayer, ref gm_PointFeature_t, (byte)0);
DrawLayersToBitmap();
Refresh();
// FREE MEMEORY
Marshal.FreeHGlobal(mAttrListPtr);
} -
Hi Mike,
I removed the [StructLayout(LayoutKind.Sequential)] and it seems to be working for now.
Will welcome any advice on the above codes...
thanks! -
I'm not really an expert on the C# marshalling thing so I'm not sure exactly what the issue was. Nothing jumped out at me as wrong in your declarations or code.
I would recommend zeroing out any structures that you pass to the SDK before setting up the members to ensure that you don't forget anything and that any padding bytes are set to 0 in case new members are added in those pad bytes in later versions of the SDK.
It also looks like you are setting up an attribute list but setting the mNumAttrs value to 0, which of course means the attribute list will be ignored. I assume this was for testing purposes though.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hi Mike,
Is there any way to detect if I have clicked on a particular point?
Like a callback function ?
I have to change the symbol if I clicked on the point.
Thanks alot for your help.
Regards,
Chong Hoong -
Chong,
You can use the GM_FindNearestFeatures function to find the displayed feature(s) closest to your click point within some radius. There is an example of using this in the C++ sample application included with the SDK to show information about a feature when you right-click on it.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hi Mike,
Thanks it worked
However, for each feature point I have 2 states. Selected and unselected.
So I added 2 feature points in the same location, and hide(delete)/show only 1 of them at any time.
I also added 2 different symbols to represent the selected and unselected state.
Is there any way to find out if the particular feature i clicked is displayed or hidden (deleted) ?
Thanks alot!
Regards,
Chong Hoong -
Chong,
If a feature is marked as deleted then the GM_FindNearestFeatures function should not find it. So if you find a feature with that function, you know it is not deleted.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Is there a way for custom point symbols to be added from an in-memory bitmap instead of loading from File??
-
That is not currently possible, you would need to save the in-memory bitmap to a file, then add it (you can delete the file once the add call completes as the SDK makes a copy of it).
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
If the application closes, does the copy that the SDK makes go away or does it stay?
If two instances of the application are open, do they use the same symbol instances, ie, can I load two different images under the same name provided they are in different application instances?
Thanks once again for your time and effort.
Categories
- 13K All Categories
- 5.8K Features Discussion
- 350 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 652 GM Script Language
- 56 User Scripts
- 115 GPS Features
- 421 Projection Questions
- 837 Raster Data
- 1.4K Vector Data
- 6.7K Support
- 182 Announcement and News
- 943 Bug Report
- 562 SDK
- 1.2K Suggestion Box
- 3.8K Technical Support
- 581 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 245 How I use Global Mapper
- 111 Global Mapper Forum Website
