public void btnChangeRefscaleReset(object sender, EventArgs e) { QueuedTask.Run(() => { FeatureLayer a = MapView.Active.Map.Layers[1] as FeatureLayer; CIMTextSymbol s = a.LabelClasses[0].GetTextSymbol(); s.SetSize(14); a.LabelClasses[0].SetTextSymbol(s); }); }
public void btnChangeLayerFilter(object sender, EventArgs e) { var labelExpression = ((RadioButton)sender).Tag; QueuedTask.Run(() => { //Get the active map's definition - CIMMap. var cimMap = MapView.Active.Map.GetDefinition(); //Get the labeling engine from the map definition var cimGeneralPlacement = cimMap.GeneralPlacementProperties; if (cimGeneralPlacement is CIMMaplexGeneralPlacementProperties) { Debug.WriteLine("already using maplex"); } else { //Create a new Maplex label engine properties var cimMaplexGeneralPlacementProperties = new CIMMaplexGeneralPlacementProperties(); //Set the CIMMap's GeneralPlacementProperties to the new label engine cimMap.GeneralPlacementProperties = cimMaplexGeneralPlacementProperties; } FeatureLayer a = MapView.Active.Map.Layers[1] as FeatureLayer; if (labelExpression.ToString() == "None") { a.SetLabelVisibility(false); } else { //var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(s => s.ShapeType == esriGeometryType.esriGeometryPolyline); a.SetLabelVisibility(true); a.LabelClasses[0].SetExpression(labelExpression.ToString()); //$feature.RMNUMB + TextFormatting.NewLine + $feature.RMAREA CIMTextSymbol s = a.LabelClasses[0].GetTextSymbol(); s.SetSize(14); a.LabelClasses[0].SetTextSymbol(s); var lyrDefn = a.GetDefinition() as CIMFeatureLayer; //Get the label classes - we need the first one var listLabelClasses = lyrDefn.LabelClasses.ToList(); var theLabelClass = listLabelClasses.FirstOrDefault(); theLabelClass.MaplexLabelPlacementProperties.ThinDuplicateLabels = true; lyrDefn.LabelClasses = listLabelClasses.ToArray(); //Set the labelClasses back a.SetDefinition(lyrDefn); //set the layer's definition } }); }
public void btnChangeLayerFilter(object sender, EventArgs e) { var labelExpression = ((RadioButton)sender).Tag; QueuedTask.Run(() => { //Get the active map's definition - CIMMap. var cimMap = MapView.Active.Map.GetDefinition(); //Get the labeling engine from the map definition var cimGeneralPlacement = cimMap.GeneralPlacementProperties; if (cimGeneralPlacement is CIMMaplexGeneralPlacementProperties) { Debug.WriteLine("already using maplex"); } else { //Create a new Maplex label engine properties var cimMaplexGeneralPlacementProperties = new CIMMaplexGeneralPlacementProperties(); //Set the CIMMap's GeneralPlacementProperties to the new label engine cimMap.GeneralPlacementProperties = cimMaplexGeneralPlacementProperties; } FeatureLayer a = MapView.Active.Map.Layers[1] as FeatureLayer; if (labelExpression.ToString() == "None") { a.SetLabelVisibility(false); } else { a.SetLabelVisibility(true); a.LabelClasses[0].SetExpression(labelExpression.ToString()); //$feature.RMNUMB + TextFormatting.NewLine + $feature.RMAREA CIMTextSymbol s = a.LabelClasses[0].GetTextSymbol(); s.SetSize(14); a.LabelClasses[0].SetTextSymbol(s); } }); }