Select to view content in your preferred language

createSwatch doesn't work anymore since 200.5 with

266
5
10-01-2024 10:16 AM
dev4567
Emerging Contributor

Context 

  • use custom `DictionarySymbolStyle` to render App6D symbols;
  • use "ORDERED ANCHOR POINTS" for the dictionary "model" configuration;
  • call `createSwatch(scale, width, height)` at symbol obtained from the dictionary;

Issue

For the symbols with the `CIMGeometricEffectControlMeasureLine` `createSwatch` doesn't work properly anymore – the bitmap returned from the function has a single diagonal line no matter what dictionary content is. Though everything worked well with the SDK 200.4. Note: map rendering still works fine, it's only the `createSwatch` function has issue.

 

0 Kudos
5 Replies
PreetiMaske
Esri Regular Contributor

Nothing jumps out to me why would `createSwatch` be different in 200.4. No changes went in on that front, but I am happy to take a look. Can you please share the SIDC code and the two images before and after 200.4 so I can see what is the difference?
Also another reason could the version of App6D is outdated. Where did you get the App6D stylx file from that is used in your app? 

 

0 Kudos
dev4567
Emerging Contributor

The style dictionary is custom but based on the app6d file provided here – also, it produces the same problematic behaviour described: https://www.arcgis.com/home/item.html?id=ef2f9d1d572d405ab47675679b07ccd4

 

As for the SIDC, it' basically any (I suspect) with the applied effect of `CIMGeometricEffectControlMeasureLine` https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/control-measure-line-symbol-e...

E.g. 10012500003423000000

dev4567_0-1728284540061.png

dev4567_1-1728284555583.png

 

0 Kudos
PreetiMaske
Esri Regular Contributor

Is the first one swatch/image using 200.4 and second image from 200.5 swatch?
I am trying to reproduce the behavior using App6d and the sidc code you provided and I am getting following swatch image

PreetiMaske_1-1729026382510.png

 

    try
    {
        DictionarySymbolStyle symbolStyle = await DictionarySymbolStyle.CreateFromFileAsync("C:\\Program Files\\ArcGIS\\Pro\\Resources\\Dictionaries\\app6d\\app6d.stylx");
        var cf = symbolStyle.Configurations.ToList().Find(cn => cn.Name == "model");
        if (cf != null)
            cf.Value = "ORDERED ANCHOR POINTS";
        Dictionary<string, object> attributes = new Dictionary<string, object>
{
    { "sidc", 10012500003423000000 }
};

        Symbol symbol = await symbolStyle.GetSymbolAsync(attributes);
        RuntimeImage image = await symbol.CreateSwatchAsync(90, 90, 96, Color.Black);

        swatch.Source = await image.ToImageSourceAsync();
    }

    catch (Exception ex)
    {
    }
}

 

I think I need a more concrete repro sample so I can better assist you.

 



0 Kudos
dev4567
Emerging Contributor

Is the first one swatch/image using 200.4 and second image from 200.5 swatch?

That is correct.

I think I need a more concrete repro sample so I can better assist you.

Will do and keep you updated once ready.

 

Anyway, what you've got for the 10012500003423000000 – is wrong (see Seize App6d symbol).

Meanwhile, could you please try 10012500003401000000? This should be Mission Tasks: Block – quite a simple symbol to draw with the help of CIMGeometricEffectControlMeasureLine

dev4567_0-1729681862777.png

 

0 Kudos
PreetiMaske
Esri Regular Contributor

Ok, I guess I understand the problem you are running into.
The problem is setting configuration to `Ordered Anchor Points` without actual control points.
The purpose of this configuration is to draw the graphic or feature using the specified control points based as geometry and the correct symbol is returned. In this case it is important that geometry passed should have correct number of control points as defined in the standard.

Since you are just trying to get a swatch and there are no features or graphics being drawn, there are two options you can choose from. Both approaches listed below are just ideas and are not a resolution to your issue.

- If you want to just get a symbol for an sidc you could try to NOT set `Ordered Anchor points` configuration. That way stylx can return you the base template symbol. But, caveat here is base template may not look like actual symbol. 

PreetiMaske_0-1729814307919.png

 


- If you do want the exact symbol then you should use CreateSwatchAsync() overload that takes a geometry and for that geometry you should pass in a polyline with right number of control points. Note, I have only tried `10012500003401000000` from App6d which looked and haven't tested more complex symbols. There could be issues with this approach as well and you need to know the right number of control points, define the right coordinates and right geometry type. So this is not simple either.

PreetiMaske_1-1729814320617.png

 

 

 

    try
    {
        DictionarySymbolStyle symbolStyle = await DictionarySymbolStyle.CreateFromFileAsync("C:\\Program Files\\ArcGIS\\Pro\\Resources\\Dictionaries\\app6d\\app6d.stylx");
        var cf = symbolStyle.Configurations.ToList().Find(cn => cn.Name == "model");
        if (cf != null)
            cf.Value = "ORDERED ANCHOR POINTS";
        Dictionary<string, object> attributes = new Dictionary<string, object>
{
    { "sidc", 10012500003401000000 }
};

        IList<MapPoint> mps= new List<MapPoint>();
        mps.Add(new MapPoint(30, 10));
        mps.Add(new MapPoint(30, -10));
        mps.Add(new MapPoint(-30, 0));
        Esri.ArcGISRuntime.Geometry.Polyline mlp = new Esri.ArcGISRuntime.Geometry.Polyline(mps);

        Symbol symbol = await symbolStyle.GetSymbolAsync(attributes);
        RuntimeImage image = await symbol.CreateSwatchAsync(90, 90, 96, Color.Black,mlp);

        swatch.Source = await image.ToImageSourceAsync();
    }

 

 

 

 

 

0 Kudos