Exemplo n.º 1
0
        public void AddMask(GCDCore.Project.Masks.AttributeFieldMask mask)
        {
            IGroupLayer pProjLyr      = AddProjectGroupLayer();
            IGroupLayer pGrpLayer     = ArcMapUtilities.GetGroupLayer(MasksGroupLayer, pProjLyr);
            short       dTransparency = GCDCore.Properties.Settings.Default.TransparencyAssociatedLayers ? GCDCore.Properties.Settings.Default.AutoTransparencyValue : (short)-1;

            IFeatureRenderer pRenderer   = null;
            string           queryFilter = string.Empty;
            string           labelField  = string.Empty;

            if (mask is GCDCore.Project.Masks.RegularMask)
            {
                GCDCore.Project.Masks.RegularMask rMask = mask as GCDCore.Project.Masks.RegularMask;

                pRenderer = VectorSymbolization.GetRegularMaskRenderer(rMask) as IFeatureRenderer;

                // Create a definition query if some features are not included

                if (rMask._Items.Any(x => !x.Include))
                {
                    queryFilter = string.Format("\"{0}\" IN ('{1}')", mask._Field, string.Join("','", rMask._Items.Where(x => x.Include).Select(y => y.FieldValue)));
                }
            }
            else if (mask is GCDCore.Project.Masks.DirectionalMask)
            {
                GCDCore.Project.Masks.DirectionalMask dirMask = mask as GCDCore.Project.Masks.DirectionalMask;
                // Directional mask. Black outline with labels
                pRenderer = VectorSymbolization.GetDirectionalMaskRenderer(dirMask) as IFeatureRenderer;

                labelField = string.IsNullOrEmpty(dirMask.LabelField) ? dirMask._Field : dirMask.LabelField;
            }

            VectorSymbolization.AddToMapVector(mask.Vector.GISFileInfo, mask.Name, pGrpLayer, mask._Field, pRenderer, queryFilter, labelField, dTransparency);
        }
Exemplo n.º 2
0
        public static ISimpleRenderer GetDirectionalMaskRenderer(GCDCore.Project.Masks.DirectionalMask mask)
        {
            RgbColor rgb = new RgbColor();

            rgb.Red   = 0;
            rgb.Blue  = 0;
            rgb.Green = 0;

            ISimpleFillSymbol symbol = new SimpleFillSymbol();

            symbol.Style         = esriSimpleFillStyle.esriSFSHollow;
            symbol.Outline.Width = 1.0;
            ILineSymbol pLineSymbol = symbol.Outline;

            pLineSymbol.Color = rgb;
            pLineSymbol.Width = 1;
            symbol.Outline    = pLineSymbol;

            // These properties should be set prior to adding values
            ISimpleRenderer pRender = new SimpleRenderer();

            pRender.Label  = "Directional Mask";
            pRender.Symbol = symbol as ISymbol;

            return(pRender);
        }