コード例 #1
0
        public TextStyleUserControl(IconTextStyle style, StyleBuilderArguments requiredValues)
        {
            InitializeComponent();
            StyleBuilderArguments = requiredValues;
            viewModel             = new TextStyleViewModel(style, StyleBuilderArguments);
            DataContext           = viewModel;
            cm.DataContext        = viewModel;
            iconTextStyle         = style;
            if (requiredValues.FeatureLayer is InMemoryFeatureLayer)
            {
                ViewDataButton.IsEnabled = false;
            }

            var image = viewModel.ActualObject.GetPreviewImage();

            previewImage.Width  = image.Width > fixedSize ? fixedSize : image.Width;
            previewImage.Height = image.Height > fixedSize ? fixedSize : image.Height;

            string helpUri = GisEditor.LanguageManager.GetStringResource("LabelStyleHelp");

            if (!string.IsNullOrEmpty(helpUri))
            {
                HelpUri = new Uri(helpUri);
            }
        }
コード例 #2
0
        public SelectionAndQueryingRibbonGroupViewModel()
        {
            spatialQueryModeEntities = InitSpatialQueryModeEntities();
            layers = new ObservableCollection <CheckableItemViewModel <FeatureLayer> >();

            AreaStyle selectionAreaStyle = new AreaStyle(new GeoPen(GeoColor.StandardColors.Yellow, 3));

            selectionAreaStyle.Name = "Selected Area Style";
            LineStyle selectionLineStyle = new LineStyle(new GeoPen(GeoColor.StandardColors.Yellow, 5));

            selectionLineStyle.Name = "Selected Line Style";
            PointStyle selectionPointStyle = new PointStyle();

            selectionPointStyle.Name      = "Selected Point Style";
            selectionPointStyle.SymbolPen = new GeoPen(GeoColor.StandardColors.Yellow, 3);
            IconTextStyle selectionTextStyle = new IconTextStyle();

            selectionTextStyle.TextColumnName = SelectionUIPlugin.FeatureIdColumnName;
            selectionTextStyle.TextSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Yellow);
            selectionTextStyle.Font           = new GeoFont("Arial", 7, DrawingFontStyles.Regular);
            selectionTextStyle.CustomTextStyles.Add(new TextStyle(SelectionUIPlugin.FeatureIdColumnName, new GeoFont("Arial", 7, DrawingFontStyles.Regular), new GeoSolidBrush(GeoColor.StandardColors.Yellow)));
            selectionTextStyle.Name = "Selected Text Style";

            selectionCompositeStyle = new CompositeStyle();
            selectionCompositeStyle.Styles.Add(selectionAreaStyle);
            selectionCompositeStyle.Styles.Add(selectionLineStyle);
            selectionCompositeStyle.Styles.Add(selectionPointStyle);
            selectionCompositeStyle.Styles.Add(selectionTextStyle);

            UpdateStylePreview();
        }
コード例 #3
0
        protected override Style GetDefaultStyleCore()
        {
            var textStyle = new IconTextStyle()
            {
                Font                        = new GeoFont("Arial", 9),
                TextSolidBrush              = new GeoSolidBrush(GeoColor.SimpleColors.Black),
                XOffsetInPixel              = 0,
                YOffsetInPixel              = 0,
                RotationAngle               = 0,
                OverlappingRule             = LabelOverlappingRule.NoOverlapping,
                ForceHorizontalLabelForLine = false,
                GridSize                    = 100,
                SplineType                  = SplineType.Default,
                DuplicateRule               = LabelDuplicateRule.UnlimitedDuplicateLabels,
                SuppressPartialLabels       = false,
                LabelAllLineParts           = false,
                LabelAllPolygonParts        = true,
                TextLineSegmentRatio        = 1.5,
                IconImageScale              = 1,
                MaskMargin                  = 3,
                PolygonLabelingLocationMode = PolygonLabelingLocationMode.BoundingBoxCenter
            };

            textStyle.HaloPen.Width = 3;
            return(textStyle);
        }
コード例 #4
0
        public static CompositeStyle GetInitialCompositeStyle()
        {
            AreaStyle measurementAreaStyle = new AreaStyle(new GeoPen(GeoColor.SimpleColors.Black, 2), new GeoSolidBrush(GeoColor.StandardColors.Transparent));

            measurementAreaStyle.Name = "Measurement Area Style";
            LineStyle measurementLineStyle = new LineStyle(new GeoPen(GeoColor.SimpleColors.Black, 2), new GeoPen(GeoColor.StandardColors.Transparent));

            measurementLineStyle.Name = "Measurement Line Style";
            IconTextStyle measurementPointStyle = new IconTextStyle();

            measurementPointStyle.Name                        = "Measurement Text Style";
            measurementPointStyle.TextColumnName              = measureResultColumnName;
            measurementPointStyle.Font                        = new GeoFont("Arial", 12);
            measurementPointStyle.TextSolidBrush              = new GeoSolidBrush(GeoColor.SimpleColors.Black);
            measurementPointStyle.HaloPen                     = new GeoPen(GeoColor.StandardColors.White, 3);
            measurementPointStyle.BestPlacement               = false;
            measurementPointStyle.DuplicateRule               = LabelDuplicateRule.UnlimitedDuplicateLabels;
            measurementPointStyle.OverlappingRule             = LabelOverlappingRule.AllowOverlapping;
            measurementPointStyle.PolygonLabelingLocationMode = PolygonLabelingLocationMode.BoundingBoxCenter;
            measurementPointStyle.ForceLineCarriage           = true;
            measurementPointStyle.SuppressPartialLabels       = false;
            measurementPointStyle.SplineType                  = SplineType.StandardSplining;
            measurementPointStyle.TextLineSegmentRatio        = 10000;
            measurementPointStyle.AllowLineCarriage           = true;
            measurementPointStyle.IsHaloEnabled               = true;

            CompositeStyle measurementStyle = new CompositeStyle();

            measurementStyle.Styles.Add(measurementAreaStyle);
            measurementStyle.Styles.Add(measurementLineStyle);
            measurementStyle.Styles.Add(measurementPointStyle);
            return(measurementStyle);
        }
コード例 #5
0
        public static IconTextStyle EditStyles(this StylePluginManager styleManager, StyleBuilderArguments styleArguments, IconTextStyle textStyle)
        {
            TextStyle resultTextStyle = EditStyles <TextStyle>(styleManager, styleArguments, textStyle, s => s.CustomTextStyles);

            if (resultTextStyle == null)
            {
                return(null);
            }

            IconTextStyle iconTextStyle = new IconTextStyle();

            iconTextStyle.Name = resultTextStyle.Name;
            foreach (var tmpStyle in resultTextStyle.CustomTextStyles)
            {
                iconTextStyle.CustomTextStyles.Add(tmpStyle);
            }

            return(iconTextStyle);
        }
コード例 #6
0
 public IconTextStyleItem(Style style)
     : base(style)
 {
     iconTextStyle = style as IconTextStyle;
 }
コード例 #7
0
        public TextStyleViewModel(IconTextStyle style, StyleBuilderArguments requiredValues)
            : base(style)
        {
            gridSizes = new Collection <int> {
                500, 400, 300, 200, 150, 120, 100, 80, 40, 20, 10
            };
            dataFormats = new Collection <BoundItem>
            {
                new BoundItem("None", string.Empty),
                new BoundItem("mm/dd/yyyy", "{0:MM/dd/yyyy}"),
                new BoundItem("dd/mm/yyyy", "{0:dd/MM/yyyy}"),
                new BoundItem("mmmm,yyyy", "{0:mmmm,yyyy}"),
                new BoundItem("yyyy,mmmm", "{0:yyyy,mmmm}"),
                new BoundItem("mmmm,dd", "{0:mmmm,dd}"),
                new BoundItem("d mmmm", "{0:d mmmm}"),
                new BoundItem("mm/dd/yyyy hh:mm:ss", "{0:MM/dd/yyyy hh:mm:ss}"),
                new BoundItem("dd/mm/yyyy hh:mm:ss", "{0:dd/MM/yyyy hh:mm:ss}"),
                new BoundItem("hh:mm:ss", "{0:hh:mm:ss}"),
                new BoundItem("hh:mm", "{0:hh:mm}"),
                new BoundItem("hh", "{0:hh:mm}"),
                new BoundItem("mm", "{0:mm}"),
                new BoundItem("ss", "{0:ss}")
            };
            numericFormats = new Collection <BoundItem>
            {
                new BoundItem("None", string.Empty),
                new BoundItem("Currency", "{0:C}"),
                new BoundItem("Decimal", "{0:0.0}"),
                new BoundItem("Scientific (exponential)", "{0:E}"),
                new BoundItem("Fixed-point", "{0:F}"),
                new BoundItem("General", "{0:G}"),
                new BoundItem("Number", "{0:N0}"),
                new BoundItem("Percent", "{0:0%}"),
                new BoundItem("Round-trip", "{0:R}"),
                new BoundItem("Custom", "{0:N4}")
            };
            ActualObject    = style;
            actualTextStyle = style;
            RequiredValues  = requiredValues;

            var shpLayer = RequiredValues.FeatureLayer as ShapeFileFeatureLayer;

            if (shpLayer != null)
            {
                shpLayer.Open();
                featureSourceColumns = shpLayer.FeatureSource.GetColumns();
            }

            if (actualTextStyle.IsLabelFunctionEnabled)
            {
                IsLabelFunctions = true;
                string text = actualTextStyle.LabelFunctionsScript;
                foreach (var item in actualTextStyle.LabelFunctionColumnNames)
                {
                    if (text.Contains(item.Key))
                    {
                        text = text.Replace(item.Key, "[" + item.Value + "]");
                    }
                }
                functionText = text;
            }
            else if (TextColumnName.Contains("[") && TextColumnName.Contains("]"))
            {
                IsCustomText = true;
            }
            else
            {
                BasicLabelIsChecked = true;
            }

            try
            {
                if (string.IsNullOrEmpty(TextColumnName))
                {
                    string columnContainsName = RequiredValues.ColumnNames.Where(columnName => columnName.IndexOf("name", StringComparison.InvariantCultureIgnoreCase) != -1).FirstOrDefault();
                    if (!string.IsNullOrEmpty(columnContainsName))
                    {
                        string alias = RequiredValues.FeatureLayer.FeatureSource.GetColumnAlias(columnContainsName);
                        SelectedTextColumnName = new KeyValuePair <string, string>(columnContainsName, alias);
                    }
                    else
                    {
                        string firstColumn = RequiredValues.ColumnNames.FirstOrDefault();
                        if (!string.IsNullOrEmpty(firstColumn))
                        {
                            string alias = RequiredValues.FeatureLayer.FeatureSource.GetColumnAlias(firstColumn);
                            SelectedTextColumnName = new KeyValuePair <string, string>(firstColumn, alias);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex));
                if (!String.IsNullOrEmpty(style.TextColumnName))
                {
                    SelectedTextColumnName = ColumnNames.FirstOrDefault();

                    CustomLabelCheckButtonVisibility = Visibility.Collapsed;
                    ViewDataButtonVisibility         = Visibility.Collapsed;
                    PlacementTabVisibility           = Visibility.Collapsed;
                    DuplicationTabVisibility         = Visibility.Collapsed;
                    IconTabVisibility = Visibility.Collapsed;
                }
            }

            if (GisEditor.ActiveMap != null && GisEditor.ActiveMap.GetFeatureLayers(true).Count == 0)
            {
                ViewDataButtonVisibility = Visibility.Collapsed;
            }

            ChangeInnerControlsVisibility();
            //LoadSwitchableStylePlugins(StylePluginHelper.GetStyleProviderTypesAccordingToShapeType(requiredValues.ShapeType));
            //LoadSwitchableStylePlugins(StyleCategories.Text);
            //SetDefaultSelectedStyleType();
            HelpKey = "LabelStyleHelp";
        }