Hi,
isn't the draw order "saved" when then drawing is saved?
Or do you mean something else?
Rob
Hi,
isn't the draw order "saved" when then drawing is saved?
Or do you mean something else?
Rob
Hi Robert,
In the attched pic, The Draw order panel consists of some layers After Loading the displaying model. Now I made change in the prioity of the Layers in Draw order section.
This change in the order for the layers, in the Draw order section is to be saved from my c# code.Which I failed to do that?
Please let me know if i can provide more info.
Hi Robert,
In the attched pic, The Draw order panel consists of some layers After Loading the displaying model. Now I made change in the prioity of the Layers in Draw order section.
This change in the order for the layers, in the Draw order section is to be saved from my c# code.Which I failed to do that?
Please let me know if i can provide more info.
Hi,
do you use GenerateGraphics / IndustryModel or what do you mean by "After Loading the displaying model"?
If so - then the display model needs to be saved back to disk. But I'm not sure whether you use plain Map or an IndustryModel. Let me know,
Rob
Hi,
do you use GenerateGraphics / IndustryModel or what do you mean by "After Loading the displaying model"?
If so - then the display model needs to be saved back to disk. But I'm not sure whether you use plain Map or an IndustryModel. Let me know,
Rob
Yes Robert. We use GenerateGraphics for loading Display Model.
I am saving the Display model too.. but in the saved display Model , in TBDMMAP file the DisplayModelMapLayer order which i changed(in Draw Order) is not geeting reflected and all other changes like layer symbol change and layer visibility are getting saved with my code.
But when i test this without my project .Then everything is working fine
Yes Robert. We use GenerateGraphics for loading Display Model.
I am saving the Display model too.. but in the saved display Model , in TBDMMAP file the DisplayModelMapLayer order which i changed(in Draw Order) is not geeting reflected and all other changes like layer symbol change and layer visibility are getting saved with my code.
But when i test this without my project .Then everything is working fine
Hi,
I had a quick look at the API docs and it seems that IM API has additional functionailty for changing layer draw order. Not sure if this is an optional or required addition:
IDisplayModelMap..::..MoveLayer Method - Moves a layer within the draw order to the specified index.
There is also an event :
IGraphicsGenerator..::..DisplayModelModified Event The Display Model was modified in the Display Manager. Possible sources: - Layer stylization modified - Layer added via "Data Connect" - Layer added via "Load Layer" - Layer added via "Drag and Drop" - Layer copy and pasted - Layer removed - Draw order of layers changed* - Grouping of layers changed* * Not available through GWS events.
Maybe the change in Map's DisplayManager has no direct impact on IM display model (tbdmmap) and therefore IM display model needs to be modified as well before saving it back?
Just guessing, sorry, didn't find any code sample...
Good luck, Rob
Hi,
I had a quick look at the API docs and it seems that IM API has additional functionailty for changing layer draw order. Not sure if this is an optional or required addition:
IDisplayModelMap..::..MoveLayer Method - Moves a layer within the draw order to the specified index.
There is also an event :
IGraphicsGenerator..::..DisplayModelModified Event The Display Model was modified in the Display Manager. Possible sources: - Layer stylization modified - Layer added via "Data Connect" - Layer added via "Load Layer" - Layer added via "Drag and Drop" - Layer copy and pasted - Layer removed - Draw order of layers changed* - Grouping of layers changed* * Not available through GWS events.
Maybe the change in Map's DisplayManager has no direct impact on IM display model (tbdmmap) and therefore IM display model needs to be modified as well before saving it back?
Just guessing, sorry, didn't find any code sample...
Good luck, Rob
not related to my previous posting - but you could also try to use SaveAs instead of Save - for testing purpose, any difference?
not related to my previous posting - but you could also try to use SaveAs instead of Save - for testing purpose, any difference?
No Difference as per my understanding..
Thanks a lot for your valuable responses.
here the issue is Autodesk Map3d Save as or save DisplayModel layer as functionalities Are worrking fine...
I need to implement the same functionality in my code as per my req. Everything is working except this draw order issue. So i am looking to handle this.
which I was failing..
So Still trying to get the sample code..
No Difference as per my understanding..
Thanks a lot for your valuable responses.
here the issue is Autodesk Map3d Save as or save DisplayModel layer as functionalities Are worrking fine...
I need to implement the same functionality in my code as per my req. Everything is working except this draw order issue. So i am looking to handle this.
which I was failing..
So Still trying to get the sample code..
Hi,
so I did a quick test and it seems to be as I thought. Changing draw order in Map Display Manager does not automatically reflects in IM DisplayModel layer draw order. See sampel code below - if you change draw order in DisplayManager the draw order <index> value for display model as shown in MessageBox has not changed. But you can move layer accordingly in IM DisplayMap.
Autodesk.Map.IM.Display.GraphicsGeneration.IGraphicsGenerator gg = Autodesk.Map.IM.Display.GraphicsGeneration.GraphicsGeneratorFactory.Instance;
Autodesk.Map.IM.Display.DisplayModelManagement.IDisplayModel dm = gg.DisplayModel;
this.Application.MessageBox(dm.FileName);
//if you have more than one map in your DisplayModel....
Autodesk.Map.IM.Display.DisplayModelManagement.IDisplayModelMap dmMap = dm.Maps[0];
foreach (IDisplayModelMapLayer dmMapLayer in dmMap.Layers)
{
this.Application.MessageBox(dmMapLayer.NodeName+ " "+ dmMap.Layers.IndexOf(dmMapLayer).ToString());
}
Good luck, Rob
Hi,
so I did a quick test and it seems to be as I thought. Changing draw order in Map Display Manager does not automatically reflects in IM DisplayModel layer draw order. See sampel code below - if you change draw order in DisplayManager the draw order <index> value for display model as shown in MessageBox has not changed. But you can move layer accordingly in IM DisplayMap.
Autodesk.Map.IM.Display.GraphicsGeneration.IGraphicsGenerator gg = Autodesk.Map.IM.Display.GraphicsGeneration.GraphicsGeneratorFactory.Instance;
Autodesk.Map.IM.Display.DisplayModelManagement.IDisplayModel dm = gg.DisplayModel;
this.Application.MessageBox(dm.FileName);
//if you have more than one map in your DisplayModel....
Autodesk.Map.IM.Display.DisplayModelManagement.IDisplayModelMap dmMap = dm.Maps[0];
foreach (IDisplayModelMapLayer dmMapLayer in dmMap.Layers)
{
this.Application.MessageBox(dmMapLayer.NodeName+ " "+ dmMap.Layers.IndexOf(dmMapLayer).ToString());
}
Good luck, Rob
Thanks a lot for the work.
As per the above sample code, My understading is that, new index for the moved layer in the draw order section is not getting reflected throuh IM DisplayModel MapLayer.
So if we opt for IDisplayModelMap.Movelayer(layer,newIndex of this layer ).
Here how could i get newIndex by the code. if I get this index i think then the problem will be solved completely.
Please correct me if my understaing is wrong. Thanks in Advance.
Thanks a lot for the work.
As per the above sample code, My understading is that, new index for the moved layer in the draw order section is not getting reflected throuh IM DisplayModel MapLayer.
So if we opt for IDisplayModelMap.Movelayer(layer,newIndex of this layer ).
Here how could i get newIndex by the code. if I get this index i think then the problem will be solved completely.
Please correct me if my understaing is wrong. Thanks in Advance.
Hi Robert,
Thanks a lot for your suggestions on this isuue. I have worked on this to some extent as per your suggestions and finally issue got resolved.
Here is the sample code I used.
private Dictionary<string,IDisplayModelMapLayer> GetLayerFccolection(IDisplayModelMap pMap)
{
Dictionary<string,IDisplayModelMapLayer> dicCollection = new Dictionary<string,IDisplayModelMapLayer>();
IList<IDisplayModelMapLayer> layerCo = pMap.Layers;
IList<string> duplist = new List<string>();
foreach (IDisplayModelMapLayer layer in layerCo)
{
if (!dicCollection.ContainsKey(layer.FeatureClassName))
{
dicCollection.Add(layer.FeatureClassName, layer);
}
else
{
duplist.Add(layer.FeatureClassName);
}
}
return dicCollection;
}
/// <summary>
/// Function to get the layers from Map3D task pane and move them based on draw order
/// </summary>
/// <returns>layer Name and layer in Dictionary</returns>
private Dictionary<string, MgLayerBase> GetMapLayers()
{
Dictionary<string, MgLayerBase> dictionaryLayers = new Dictionary<string, MgLayerBase>();
try
{
AcMapMap acMapMapCurrent = AcMapMap.GetCurrentMap();
IDisplayModelMap pMap = loadedDisplayModel.Maps[0];
Dictionary<string, IDisplayModelMapLayer> layerCo = GetLayerFccolection(pMap);
MgLayerCollection mgLayerCollection = acMapMapCurrent.GetLayers();
for (int k = 0; k < mgLayerCollection.Count; k++)
{
MgLayerBase mgLayerBase = mgLayerCollection.GetItem(k);
string[] layerArray = mgLayerBase.FeatureClassName.Split(':');
if (layerArray.Length > 1)
{
string layer = layerArray[1];
if (layerCo.ContainsKey(layer))
{
IDisplayModelMapLayer mapLayer = layerCo[layer];
pMap.MoveLayer(mapLayer, k);
}
if (!dictionaryLayers.ContainsKey(mgLayerBase.LayerDefinition.Name))
{
dictionaryLayers.Add(mgLayerBase.LayerDefinition.Name, mgLayerBase);
}
}
}
}
catch (Exception)
{
throw;
}
return dictionaryLayers;
}
Once Again Thanks a lot..
Hi Robert,
Thanks a lot for your suggestions on this isuue. I have worked on this to some extent as per your suggestions and finally issue got resolved.
Here is the sample code I used.
private Dictionary<string,IDisplayModelMapLayer> GetLayerFccolection(IDisplayModelMap pMap)
{
Dictionary<string,IDisplayModelMapLayer> dicCollection = new Dictionary<string,IDisplayModelMapLayer>();
IList<IDisplayModelMapLayer> layerCo = pMap.Layers;
IList<string> duplist = new List<string>();
foreach (IDisplayModelMapLayer layer in layerCo)
{
if (!dicCollection.ContainsKey(layer.FeatureClassName))
{
dicCollection.Add(layer.FeatureClassName, layer);
}
else
{
duplist.Add(layer.FeatureClassName);
}
}
return dicCollection;
}
/// <summary>
/// Function to get the layers from Map3D task pane and move them based on draw order
/// </summary>
/// <returns>layer Name and layer in Dictionary</returns>
private Dictionary<string, MgLayerBase> GetMapLayers()
{
Dictionary<string, MgLayerBase> dictionaryLayers = new Dictionary<string, MgLayerBase>();
try
{
AcMapMap acMapMapCurrent = AcMapMap.GetCurrentMap();
IDisplayModelMap pMap = loadedDisplayModel.Maps[0];
Dictionary<string, IDisplayModelMapLayer> layerCo = GetLayerFccolection(pMap);
MgLayerCollection mgLayerCollection = acMapMapCurrent.GetLayers();
for (int k = 0; k < mgLayerCollection.Count; k++)
{
MgLayerBase mgLayerBase = mgLayerCollection.GetItem(k);
string[] layerArray = mgLayerBase.FeatureClassName.Split(':');
if (layerArray.Length > 1)
{
string layer = layerArray[1];
if (layerCo.ContainsKey(layer))
{
IDisplayModelMapLayer mapLayer = layerCo[layer];
pMap.MoveLayer(mapLayer, k);
}
if (!dictionaryLayers.ContainsKey(mgLayerBase.LayerDefinition.Name))
{
dictionaryLayers.Add(mgLayerBase.LayerDefinition.Name, mgLayerBase);
}
}
}
}
catch (Exception)
{
throw;
}
return dictionaryLayers;
}
Once Again Thanks a lot..
hi !
i want to use the code of the posting before.
by the call of loadedDisplayModel.Maps(0) i get a message that loadedDisplayModel is not declare!
could someone help me?
regards Jan
hi !
i want to use the code of the posting before.
by the call of loadedDisplayModel.Maps(0) i get a message that loadedDisplayModel is not declare!
could someone help me?
regards Jan
Hi Jan,
look at my code snippet above. You need to get the IDisplayModel first and from that you will be able to get the map.
By the way - it would be better to open a new discussion and not to extend a old discussion with a new question,
Rob
Hi Jan,
look at my code snippet above. You need to get the IDisplayModel first and from that you will be able to get the map.
By the way - it would be better to open a new discussion and not to extend a old discussion with a new question,
Rob
Can't find what you're looking for? Ask the community or share your knowledge.