コード例 #1
0
ファイル: Map.cs プロジェクト: AlexAbramov/gis
 private bool EnsureStyle(ref Style style, StyleTypes styleTypes)
 {
     if (style == null || !style.HasAnyFlag(styleTypes))
     {
         style = Lib.Config.styles.GetDefaultStyle(styleTypes);
     }
     return(style != null);
 }
コード例 #2
0
ファイル: StyleBuilder.cs プロジェクト: AlexAbramov/gis
        BaseStyleBuilder GetStyleBuilder(StyleTypes styleType, int index)
        {
            index += ((int)styleType) * 1000;
            if (styleBuilders.ContainsKey(index))
            {
                return(styleBuilders[index]);
            }
            BaseStyleBuilder sb = CreateStyleBuilder(styleType);

            styleBuilders[index] = sb;
            return(sb);
        }
コード例 #3
0
 public IBaseStyle GetStyle(StyleTypes styleType)
 {
     if (HasFlags(styleType))
     {
         foreach (IBaseStyle st in styles)
         {
             if (st.StyleType == styleType)
             {
                 return(st);
             }
         }
     }
     return(null);
 }
コード例 #4
0
ファイル: StyleBuilder.cs プロジェクト: AlexAbramov/gis
        private BaseStyleBuilder CreateStyleBuilder(StyleTypes styleType)
        {
            switch (styleType)
            {
            case StyleTypes.Brush: return(new BrushStyleBuilder(this, "b"));

            case StyleTypes.Image: return(new ImageStyleBuilder(this, ""));

            case StyleTypes.Pen: return(new PenStyleBuilder(this, "p"));

            case StyleTypes.Text: return(new TextStyleBuilder(this));
            }
            throw new GeoLibException("Unsupported styleType in CreateStyleBuilder: " + styleType);
        }
コード例 #5
0
        public CreateStyleViewModel()
        {
            for (var i = 0; i < StyleConstants.MaximumNumberOfGrainsInStyle; i++)
            {
                SelectedCommonGrains.Add(new CommonGrainViewModel());
            }

            for (var i = 0; i < StyleConstants.MaximumNumberOfHopsInStyle; i++)
            {
                SelectedCommonHops.Add(new CommonHopViewModel());
            }

            foreach (var styleType in Enum.GetValues <StyleType>())
            {
                var styleTypeValue = styleType.ToString();
                StyleTypes.Add(new SelectListItem(styleTypeValue, styleTypeValue));
            }
        }
コード例 #6
0
ファイル: StylesConfig.cs プロジェクト: AlexAbramov/gis
 public Style GetDefaultStyle(StyleTypes styleTypes)
 {
     if ((styleTypes & StyleTypes.PenBrushImage) == StyleTypes.PenBrushImage)
     {
         return(penStyle);
     }
     if ((styleTypes & StyleTypes.Brush) == StyleTypes.Brush)
     {
         return(brushStyle);
     }
     if ((styleTypes & StyleTypes.Pen) == StyleTypes.Pen)
     {
         return(penStyle);
     }
     if ((styleTypes & StyleTypes.Text) == StyleTypes.Text)
     {
         return(textStyle);
     }
     return(null);
 }
コード例 #7
0
ファイル: StyleMarkupInfo.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="StyleInfo"/> class.
		/// </summary>
		/// <param name="styleName">Name of the style.</param>
		/// <param name="styleType">Type of the style.</param>
		/// <param name="useType">Style usage.</param>
		/// ------------------------------------------------------------------------------------
		public StyleInfo(string styleName, StyleTypes styleType, UseTypes useType)
		{
			m_styleName = styleName;
			m_styleType = styleType;
			m_useType = useType;
		}
コード例 #8
0
 /// <summary>
 /// Sets the type of the style.
 /// </summary>
 /// <param name="styleType">Style type.</param>
 public void SetStyleType(StyleTypes styleType)
 {
     style = styleType;
 }
コード例 #9
0
        /// <summary>
        /// Gets the default sub layer properties for the chosen preset type.
        /// </summary>
        /// <returns>The sub layer properties.</returns>
        /// <param name="type">Type.</param>
        public static VectorSubLayerProperties GetSubLayerProperties(PresetFeatureType type)
        {
            //CoreOptions properties
            VectorPrimitiveType geometryType = VectorPrimitiveType.Polygon;
            string layerName    = "building";
            string sublayerName = "Untitled";

            //Line Geometry Options
            float lineWidth = 1.0f;

            //Geometry Extrusion Options
            ExtrusionType         extrusionType         = ExtrusionType.None;
            ExtrusionGeometryType extrusionGeometryType = ExtrusionGeometryType.RoofAndSide;
            string propertyName         = "height";
            float  extrusionScaleFactor = 1.0f;
            float  extrusionHeight      = 1.0f;

            //Filter Options
            LayerFilterCombinerOperationType combinerType = LayerFilterCombinerOperationType.Any;
            List <LayerFilter> filters = new List <LayerFilter>();


            // Material Options
            StyleTypes style = StyleTypes.Realistic;

            //Misc options
            bool buildingsWithUniqueIds           = true;
            PositionTargetType positionTargetType = PositionTargetType.TileCenter;

            //Modifiers
            List <MeshModifier>       meshModifiers       = new List <MeshModifier>();
            List <GameObjectModifier> gameObjectModifiers = new List <GameObjectModifier>();
            ColliderType colliderType = ColliderType.None;

            switch (type)
            {
            case PresetFeatureType.Buildings:
                layerName             = "building";
                geometryType          = VectorPrimitiveType.Polygon;
                extrusionType         = ExtrusionType.PropertyHeight;
                extrusionGeometryType = ExtrusionGeometryType.RoofAndSide;
                propertyName          = "height";
                style = StyleTypes.Realistic;
                break;

            case PresetFeatureType.Roads:
                layerName             = "road";
                geometryType          = VectorPrimitiveType.Line;
                lineWidth             = 1.0f;
                style                 = StyleTypes.Dark;
                extrusionType         = ExtrusionType.AbsoluteHeight;
                extrusionGeometryType = ExtrusionGeometryType.RoofAndSide;
                break;

            case PresetFeatureType.Points:
                layerName    = "poi_label";
                geometryType = VectorPrimitiveType.Point;
                break;

            case PresetFeatureType.Landuse:
                layerName    = "landuse";
                geometryType = VectorPrimitiveType.Polygon;
                style        = StyleTypes.Color;
                break;

            case PresetFeatureType.Custom:
                layerName    = "";
                geometryType = VectorPrimitiveType.Custom;
                style        = StyleTypes.Custom;
                break;

            default:
                break;
            }

            VectorSubLayerProperties _properties = new VectorSubLayerProperties();

            _properties.presetFeatureType = type;

            _properties.coreOptions = new CoreVectorLayerProperties
            {
                isActive      = true,
                layerName     = layerName,
                geometryType  = geometryType,
                snapToTerrain = true,
                combineMeshes = false,
                sublayerName  = sublayerName
            };

            _properties.lineGeometryOptions = new LineGeometryOptions
            {
                Width = lineWidth
            };

            _properties.extrusionOptions = new GeometryExtrusionOptions
            {
                extrusionType         = extrusionType,
                extrusionGeometryType = extrusionGeometryType,
                propertyName          = propertyName,
                extrusionScaleFactor  = extrusionScaleFactor,
                maximumHeight         = extrusionHeight
            };

            _properties.filterOptions = new VectorFilterOptions
            {
                combinerType = combinerType,
                filters      = filters
            };

            _properties.materialOptions = new GeometryMaterialOptions
            {
                style           = style,
                colorStyleColor = Constants.GUI.Colors.EDITOR_FEATURE_DEFAULT_COLOR
            };
            _properties.materialOptions.SetDefaultMaterialOptions();
            _properties.buildingsWithUniqueIds = buildingsWithUniqueIds;
            _properties.moveFeaturePositionTo  = positionTargetType;
            _properties.MeshModifiers          = meshModifiers;
            _properties.GoModifiers            = gameObjectModifiers;
            _properties.colliderOptions        = new ColliderOptions
            {
                colliderType = colliderType
            };

            return(_properties);
        }
コード例 #10
0
 private void SetFlag(StyleTypes styleTypes)
 {
     flags |= styleTypes;
 }
コード例 #11
0
 public bool HasAnyFlag(StyleTypes flags)
 {
     return((this.flags & flags) != 0);
 }
コード例 #12
0
 public void Clear()
 {
     styles.Clear(); flags = 0;
 }
コード例 #13
0
 /// <summary>
 /// Returns true if the layer uses a given style.
 /// </summary>
 /// <returns><c>true</c>, if layer uses style type was subed, <c>false</c> otherwise.</returns>
 /// <param name="style">Style.</param>
 public virtual bool SubLayerUsesStyleType(StyleTypes style)
 {
     return(materialOptions.style == style);
 }
コード例 #14
0
 public Style(StyleTypes type)
 {
     this.modalType = type;
 }
コード例 #15
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="StyleInfo"/> class.
 /// </summary>
 /// <param name="styleName">Name of the style.</param>
 /// <param name="styleType">Type of the style.</param>
 /// <param name="useType">Style usage.</param>
 /// ------------------------------------------------------------------------------------
 public StyleInfo(string styleName, StyleTypes styleType, UseTypes useType)
 {
     m_styleName = styleName;
     m_styleType = styleType;
     m_useType   = useType;
 }
コード例 #16
0
 public StyleType GetStyleTypeByID(int ID)
 {
     return(StyleTypes.SingleOrDefault(c => c.ID == ID));
 }
コード例 #17
0
 public List <StyleType> GetStyleTypes()
 {
     return(StyleTypes.ToList());
 }
コード例 #18
0
 /// <summary>
 /// Sets the type of the style.
 /// </summary>
 /// <param name="styleType">Style type.</param>
 public void SetStyleType(StyleTypes styleType)
 {
     style      = styleType;
     HasChanged = true;
 }
コード例 #19
0
 public bool HasFlags(StyleTypes flags)
 {
     return((this.flags & flags) == flags);
 }