public int GetCategoryHeight(MapWinGIS.ShapeDrawingOptions options) { if (this.Type == eLayerType.PolygonShapefile || this.Type == eLayerType.LineShapefile) { return(Constants.CS_ITEM_HEIGHT + 2); } if (this.Type == eLayerType.PointShapefile) { if (options.PointType == tkPointSymbolType.ptSymbolPicture && options.Picture != null) { return(options.Picture.Height * options.PictureScaleY + 2 <= Constants.CS_ITEM_HEIGHT || options.Picture == null ? Constants.CS_ITEM_HEIGHT + 2 : (int)(options.Picture.Height * options.PictureScaleY + 2)); } switch (options.PointType) { case tkPointSymbolType.ptSymbolFontCharacter: double ratio = options.FrameVisible ? 1.4 : 0.9; return((options.PointSize * ratio) + 2 <= Constants.CS_ITEM_HEIGHT ? Constants.CS_ITEM_HEIGHT : (int)(options.PointSize * ratio)); default: return(options.PointSize + 2 <= Constants.CS_ITEM_HEIGHT ? Constants.CS_ITEM_HEIGHT + 2: (int)options.PointSize + 2); } } return(0); }
/// <summary> /// Sets the properties of the labels based upon user input /// </summary> private void Controls2Appearance() { // default options MapWinGIS.ShapeDrawingOptions options = _shapefile.DefaultDrawingOptions; ShpfileType type = Globals.ShapefileType2D(_shapefile.ShapefileType); if (type == ShpfileType.SHP_POLYGON) { options.FillColor = Colors.ColorToUInteger(clpPolygonFill.Color); // hatch style is set in the corresponding event } else if (type == ShpfileType.SHP_POINT || type == ShpfileType.SHP_MULTIPOINT) { options.FillColor = Colors.ColorToUInteger(clpPointFill.Color); options.PointSize = (float)udDefaultSize.Value; } else if (type == ShpfileType.SHP_POLYLINE) { options.LineColor = Colors.ColorToUInteger(clpDefaultOutline.Color); options.LineWidth = (float)icbLineWidth.SelectedIndex + 1; // and pattern ones in case there is a single line pattern if (options.UseLinePattern) { if (options.LinePattern.Count == 1) { LineSegment line = options.LinePattern.get_Line(0); line.Color = options.LineColor; if (line.LineType == tkLineType.lltSimple) { line.LineWidth = options.LineWidth; } } } } _shapefile.SelectionColor = Colors.ColorToUInteger(clpSelection.Color); _shapefile.SelectionTransparency = transpSelection.Value; DrawAppearancePreview(); }
/// <summary> /// Sets the state of controls on the general tab on loading /// </summary> private void InitAppearanceTab() { // default options MapWinGIS.ShapeDrawingOptions options = _shapefile.DefaultDrawingOptions; groupPoint.Top = groupFill.Top; groupPoint.Left = groupFill.Left; groupLine.Top = groupFill.Top; groupLine.Left = groupFill.Left; groupFill.Visible = false; groupLine.Visible = false; groupPoint.Visible = false; icbFillStyle.ComboStyle = ImageComboStyle.HatchStyleWithNone; icbLineWidth.ComboStyle = ImageComboStyle.LineWidth; ShpfileType type = Globals.ShapefileType2D(_shapefile.ShapefileType); if (type == ShpfileType.SHP_POINT || type == ShpfileType.SHP_MULTIPOINT) { groupPoint.Visible = true; clpPointFill.Color = Colors.UintToColor(options.FillColor); } else if (type == ShpfileType.SHP_POLYLINE) { groupLine.Visible = true; } else if (type == ShpfileType.SHP_POLYGON) { groupFill.Visible = true; clpPolygonFill.Color = Colors.UintToColor(options.FillColor); } Appearance2Controls(); }