/// <summary> /// Overrides pen colors in one step. /// </summary> /// <param name="styleSet"></param> /// <param name="resourceId"></param> /// <param name="color"></param> public static void OverridePenColor(this StyleSet styleSet, StyleSetResourceId resourceId, Color color) { var settings = styleSet.GetOverriddenPenSettings(resourceId) ?? new PenSettings(); settings.Color = color; styleSet.OverridePen(resourceId, settings); }
/// <summary> /// Initialize paint settings. This is initialized after the base shape /// has been painted. /// </summary> public PaintHelper(DiagramPaintEventArgs e, ExternalConstraintShape constraintShape) { StyleSet styleSet = constraintShape.StyleSet; StyleSetResourceId penId = constraintShape.OutlinePenId; Pen pen = styleSet.GetPen(penId); Brush brush = styleSet.GetBrush(ExternalConstraintBrush); SolidBrush coloredBrush = brush as SolidBrush; // Keep the pen color in sync with the color being used for highlighting Color startColor = constraintShape.UpdateDynamicColor(constraintShape.OutlinePenId, pen); if (startColor.IsEmpty) { startColor = constraintShape.UpdateGeometryLuminosity(e.View, pen); } else { constraintShape.UpdateGeometryLuminosity(e.View, pen); } myPenStartColor = startColor; Color newColor = pen.Color; if (coloredBrush != null) { myBrushStartColor = coloredBrush.Color; coloredBrush.Color = newColor; } else { myBrushStartColor = Color.Empty; } myBrush = brush; myPen = pen; }
// This method runs per model protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); DiagramUtility.SetBackgroundGradient(classStyleSet, Color.PaleGoldenrod, Color.PapayaWhip, Color.OldLace, this, Properties.Resources.SurfaceTitle); }
//修改节点数据 void ModifyStyle(ref XmlNode xNode, StyleSet CurrentStyle) { Color cColor; String strFont; int intSize, intSharp, intMode; cColor = CurrentStyle.ForeColor; xNode.ChildNodes.Item(3).InnerText = ColorToString(cColor); cColor = CurrentStyle.BackColor; xNode.ChildNodes.Item(4).InnerText = ColorToString(cColor); cColor = CurrentStyle.FrameColor; xNode.ChildNodes.Item(5).InnerText = ColorToString(cColor); cColor = CurrentStyle.HLForeColor; xNode.ChildNodes.Item(6).InnerText = ColorToString(cColor); cColor = CurrentStyle.HLBackColor; xNode.ChildNodes.Item(7).InnerText = ColorToString(cColor); cColor = CurrentStyle.HLFrameColor; xNode.ChildNodes.Item(8).InnerText = ColorToString(cColor); intSharp = (int)CurrentStyle.Sharp; xNode.ChildNodes.Item(9).InnerText = intSharp.ToString(); intMode = (int)CurrentStyle.SmoothMode; xNode.ChildNodes.Item(10).InnerText = intMode.ToString(); strFont = CurrentStyle.charFont.Name; xNode.ChildNodes.Item(11).InnerText = strFont; intSize = Convert.ToInt32(CurrentStyle.charFont.Size); xNode.ChildNodes.Item(12).InnerText = intSize.ToString(); }
/// <summary> /// Set the font size /// </summary> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); FontSettings textSettings = new FontSettings(); classStyleSet.AddFont(FrequencyConstraintTextResource, DiagramFonts.CommentText, textSettings); }
/// <summary> /// Override the connection line pen with a dashed pen /// </summary> /// <param name="classStyleSet"></param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); IORMFontAndColorService colorService = (this.Store as IORMToolServices).FontAndColorService; Color constraintColor = colorService.GetForeColor(ORMDesignerColor.Constraint); Color activeColor = colorService.GetBackColor(ORMDesignerColor.ActiveConstraint); PenSettings settings = new PenSettings(); settings.Color = constraintColor; settings.DashStyle = DashStyle.Dash; settings.Width = 1.0F / 72.0F; // 1 Point. 0 Means 1 pixel, but should only be used for non-printed items #if VISUALSTUDIO_10_0 classStyleSet.AddPen(CustomConnectionLinePen, DiagramPens.ConnectionLine, settings); #else classStyleSet.OverridePen(DiagramPens.ConnectionLine, settings); #endif settings.Color = activeColor; classStyleSet.AddPen(ORMDiagram.StickyBackgroundResource, DiagramPens.ConnectionLine, settings); settings = new PenSettings(); settings.Width = 1.0F / 72.0F; // Soften the arrow a bit settings.Color = constraintColor; classStyleSet.OverridePen(DiagramPens.ConnectionLineDecorator, settings); settings.Color = activeColor; classStyleSet.AddPen(ORMDiagram.StickyForegroundResource, DiagramPens.ConnectionLineDecorator, settings); BrushSettings brushSettings = new BrushSettings(); brushSettings.Color = constraintColor; classStyleSet.OverrideBrush(DiagramBrushes.ConnectionLineDecorator, brushSettings); brushSettings.Color = activeColor; classStyleSet.AddBrush(ORMDiagram.StickyForegroundResource, DiagramBrushes.ConnectionLineDecorator, brushSettings); }
/// <summary> /// Replacement for <see cref="ShapeField.GetBackgroundBrush"/> that recognizes /// <see cref="IDynamicColorGeometryHost"/> /// </summary> public override Pen GetPen(DiagramClientView view, ShapeElement parentShape, ref Color oldColor) { StyleSet styleSet = (parentShape != null) ? parentShape.StyleSet : null; Color restoreColor = Color.Empty; Pen pen = null; if (styleSet != null) { StyleSetResourceId penId = GetPenId(parentShape); pen = styleSet.GetPen(penId); IDynamicColorGeometryHost dynamicColors = parentShape as IDynamicColorGeometryHost; if (dynamicColors == null || (restoreColor = dynamicColors.UpdateDynamicColor(penId, pen)).IsEmpty) { if (view != null) { restoreColor = parentShape.UpdateGeometryLuminosity(view, pen); } } else if (view != null) { parentShape.UpdateGeometryLuminosity(view, pen); } } if (pen != null && !restoreColor.IsEmpty) { restoreColor = pen.Color; } return(pen); }
/// <summary> /// Creates a new image that is a copy of another image /// </summary> /// <param name="image">Image.</param> public Image (Image image): base (image.Backend, image.ToolkitEngine) { NativeRef = image.NativeRef; requestedSize = image.requestedSize; requestedAlpha = image.requestedAlpha; styles = image.styles; Init (); }
protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); classStyleSet.AddBrush(m_backgroundBrushId, m_backgroundBrushId, new BrushSettings() { Color = Color.PeachPuff }); }
// This method runs per model protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); DiagramUtility.SetBackgroundGradient(classStyleSet, Color.Cornsilk, Color.Wheat, Color.OldLace, this, Properties.Resources.SurfaceTitle); }
protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); // Set themable colors for all instances. SetColorTheme(classStyleSet); // Subscribe to theme changed event to update themable colors for all instances if necessary. VSColorTheme.ThemeChanged += e => SetColorTheme(classStyleSet); }
/// <summary> /// Sets up the Brush to be used to draw the object and adds it to the StyleSet /// </summary> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); IORMFontAndColorService colorService = (Store as IORMToolServices).FontAndColorService; BrushSettings brushSettings = new BrushSettings(); brushSettings.Color = colorService.GetForeColor(ORMDesignerColor.RoleName); classStyleSet.AddBrush(RoleNameTextBrush, DiagramBrushes.ShapeBackground, brushSettings); }
// This method runs per model protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); DiagramUtility.SetBackgroundGradient(classStyleSet, Color.WhiteSmoke, Color.Gainsboro, Color.GhostWhite, this, Properties.Resources.SurfaceTitle); }
public static T MergeStyleSets <T>(params StyleSet <T>[] styleSets) where T : StyleSet <T>, new() { var classNameSet = new T(); var classMap = new Dictionary <string, string>(); if (!styleSets.Any()) { return(new T()); } var styleSet = styleSets[0]; StyleSet <T> concatenatedStyleSet = styleSet; if (styleSets.Any()) { concatenatedStyleSet = ConcatStyleSet(styleSets); } var registrations = new List <Registration>(); foreach (var styleSetArea in concatenatedStyleSet) { var subCompKey = nameof(concatenatedStyleSet.SubComponentStyles); if (styleSetArea.Key.properertyName == subCompKey) { classNameSet.SubComponentStyles = concatenatedStyleSet.ContainsKey(styleSetArea.Key) ? concatenatedStyleSet.SubComponentStyles : new Dictionary <string, object>(); continue; } var styles = (Style)styleSetArea.Value; (var classes, var objects) = ExtractStyleParts(styles).GetAwaiter().GetResult(); var displayName = styleSetArea.Key.key; var registration = StyleToRegistration(new Style { DisplayName = displayName }, objects.ToArray()).GetAwaiter().GetResult(); registrations.Add(registration); if (registration != null) { classMap[styleSetArea.Key.key] = registration.ClassName; var value = classes.Concat(new string[] { registration.ClassName }).Join(" "); ((IStyleSet <T>)classNameSet).AddStyle(styleSetArea.Key.properertyName, value); } } foreach (var registration in registrations) { if (registration != null) { ApplyRegistration(registration, classMap).GetAwaiter().GetResult(); } } return(classNameSet); }
private void AdjustForFillColor() { // If the shape is very dark, we make the title text white, and viceversa. StyleSet.OverrideBrushColor(DiagramBrushes.ShapeText, CachedFillColorAppearance(FillColor).TextColor); // We draw a thin outline of a sligtly different color to improve distinguishability when shape color looks like background (and because it looks good). StyleSet.OverridePenColor(OutlinePenId, CachedFillColorAppearance(FillColor).OutlineColor); // We shouldn't need to do this again unless the user changes the color for this shape. _isAdjustedForFillColor = true; }
//保存用户暂存数据到数据库 private void ApplyButton_Click(object sender, EventArgs e) { StyleSetProxy dbReader = new StyleSetProxy(); //保存数据到数据库 dbReader.SaveCurrent(ModifyStyle); //用当前用户设定样式集替换目前工作的样式集 CurrentStyle = ModifyStyle; }
//刷新两个PictureBox,并用指定样式绘图 void RefreshGraph(StyleSet PaintStyle) { //普通节点视图 NodeImage.Image = DrawNode(PaintStyle, false); NodeImage.Refresh(); //高亮节点视图 HLImage.Image = DrawNode(PaintStyle, true); HLImage.Refresh(); }
/// <summary> /// Initializes style set resources for this shape type /// </summary> /// <param name="classStyleSet">The style set for this shape class</param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); BrushSettings backgroundBrush = new BrushSettings(); backgroundBrush.Color = Color.White; classStyleSet.AddBrush(InnerAreaField.Background, DiagramBrushes.ShapeBackground, backgroundBrush); }
/// <summary> /// Initializes style set resources for this shape type /// </summary> /// <param name="classStyleSet">The style set for this shape class</param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); BrushSettings brushSettings = new BrushSettings(); brushSettings.Color = Color.FromArgb(255, 234, 197); classStyleSet.OverrideBrush(headerBackgroundBrushId, brushSettings); }
public void GeneratesDefaultClassName() { var set = new StyleSet { BackgroundColor = "blue" }; var result = _service.GetClassName(set); result.Should().Be("cssStyle-0"); }
public void UseProvidedClassNameClassName() { var set = new StyleSet { BackgroundColor = "blue" }; var result = _service.GetClassName(set, "customName"); result.Should().Be("customName-0"); }
/// <summary> /// Initialize a pen and a brush for drawing the constraint /// outlines and contents. /// </summary> /// <param name="classStyleSet">StyleSet</param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); IORMFontAndColorService colorService = (Store as IORMToolServices).FontAndColorService; BrushSettings brushSettings = new BrushSettings(); brushSettings.Color = colorService.GetForeColor(ORMDesignerColor.Constraint); classStyleSet.AddBrush(ValueRangeTextBrush, DiagramBrushes.ShapeBackground, brushSettings); }
protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); // Fill brush settings for this shape. BrushSettings backgroundBrush = new BrushSettings(); backgroundBrush.Color = Color.FromArgb(100, Color.FromKnownColor(KnownColor.Gray)); classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackground, backgroundBrush); }
/// <summary> /// Override the connection line pen with a dashed pen /// </summary> /// <param name="classStyleSet"></param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); PenSettings penSettings = new PenSettings(); penSettings.DashStyle = DashStyle.Dot; penSettings.Color = SystemColors.GrayText; penSettings.Width = 1.0F / 72.0F; // 1 Point. 0 Means 1 pixel, but should only be used for non-printed items classStyleSet.OverridePen(DiagramPens.ConnectionLine, penSettings); }
/// <summary> /// Called once on each shape or connector class. /// Sets up pens, brushes, fonts (the Style Set) and other constants for this class. /// </summary> /// <param name="classStyleSet"></param> protected override void InitializeResources(StyleSet classStyleSet) { // First the generated behavior. base.InitializeResources(classStyleSet); // This will cause OnAssociatedPropertyChanged to be called when the user changes the Sort value. AssociationLink.AssociateValueWith(Store, Association.SortDomainPropertyId); // Non bouclage UpdateDecorators(); }
/// <summary> /// Initialize a font for formatting the mandatory column contents. /// </summary> /// <param name="classStyleSet">The <see cref="StyleSet"/> being initialized.</param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); FontSettings fontSettings = new FontSettings(); fontSettings.Bold = true; classStyleSet.AddFont(MandatoryFont, DiagramFonts.ShapeText, fontSettings); this.ListField.AlternateFontId = MandatoryFont; }
/// <summary> /// Adjust the outline pen width /// </summary> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); PenSettings penSettings = new PenSettings(); penSettings.Width = 1.0F / 72.0F; // 1 Point. 0 Means 1 pixel, but should only be used for non-printed items penSettings.Color = SystemColors.GrayText; classStyleSet.OverridePen(DiagramPens.ShapeOutline, penSettings); }
public string Process(string className, StyleSet set) { if (set is null) { throw new ArgumentNullException(nameof(set)); } return(WrapInClassSelector(className, Process(set))); }
public static void SetBackgroundGradient( StyleSet classStyleSet, Color backgroundGradientColor, Color backgroundSelectedGradientColor, Color backgroundSelectedInactiveGradientColor, Diagram diagram, string surfaceTitle) { #region Set background gradient style and shape attributes // Fill brush settings for background (Start gradient color). BrushSettings backgroundBrush = new BrushSettings(); backgroundBrush.Color = backgroundGradientColor; classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackground, backgroundBrush); // Selected state backgroundBrush = new BrushSettings(); backgroundBrush.Color = backgroundSelectedGradientColor; classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackgroundSelected, backgroundBrush); // SelectedInactive state backgroundBrush = new BrushSettings(); backgroundBrush.Color = backgroundSelectedInactiveGradientColor; classStyleSet.OverrideBrush(DiagramBrushes.ShapeBackgroundSelectedInactive, backgroundBrush); // We should find a "Background" field created when we set the // HasBackgroundGradient property to "true" AreaField background = diagram.FindShapeField("Background") as AreaField; if (background != null) { background.DefaultReflectParentSelectedState = true; //background.AnchoringBehavior.SetBottomAnchor(AnchoringBehavior.Edge.Bottom, diagram.MaximumSize.Height / 2); } #endregion #region Set Diagram font and text attributes // Custom font styles for diagram title FontSettings fontSettings; fontSettings = new FontSettings(); fontSettings.Style = FontStyle.Bold; fontSettings.Size = 9 / 72.0F; classStyleSet.OverrideFont(DiagramFonts.ShapeTitle, fontSettings); // Create a text field for the Diagram Title TextField textField = new TextField("DiagramTitle"); textField.DefaultText = surfaceTitle; textField.DefaultVisibility = true; textField.DefaultAutoSize = true; textField.DefaultFontId = DiagramFonts.ShapeTitle; textField.AnchoringBehavior.SetLeftAnchor(AnchoringBehavior.Edge.Left, 0.33); textField.AnchoringBehavior.SetTopAnchor(AnchoringBehavior.Edge.Top, 0.07); diagram.ShapeFields.Add(textField); #endregion }
internal Context(object backend, Toolkit toolkit, ContextBackendHandler handler, bool getGlobalStyles = true) : base(backend, toolkit, handler) { this.handler = handler; if (getGlobalStyles) { styles = globalStyles; if (styles != StyleSet.Empty) handler.SetStyles (Backend, styles); } }
/// <summary> /// Add the operator pen to the style set. /// </summary> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); PenSettings penSettings = new PenSettings(); penSettings.Width = 1 / 72f; penSettings.StartCap = LineCap.Square; penSettings.EndCap = LineCap.Square; classStyleSet.AddPen(OperatorResource, DiagramPens.ShapeOutline, penSettings); }
/// <summary> /// Initializes the resources for all fields of this type. /// </summary> public static void InitializeInstanceResources(StyleSet classStyleSet, float fontSize, Color fontColor) { FontSettings fontSettings = new FontSettings(); fontSettings.Style = FontStyle.Bold; fontSettings.Size = fontSize; classStyleSet.OverrideFont(DiagramFonts.ShapeTitle, fontSettings); BrushSettings brushSettings = new BrushSettings(); brushSettings.Color = fontColor; classStyleSet.OverrideBrush(DiagramBrushes.ShapeText, brushSettings); }
/// <summary> /// Initializes style set resources for this shape type /// </summary> /// <param name="classStyleSet">The style set for this shape class</param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); AssociateValueWith(Store, Association.SourceDeleteActionDomainPropertyId); AssociateValueWith(Store, Association.TargetDeleteActionDomainPropertyId); AssociateValueWith(Store, Association.SourceMultiplicityDomainPropertyId); AssociateValueWith(Store, Association.TargetMultiplicityDomainPropertyId); AssociateValueWith(Store, Association.PersistentDomainPropertyId); }
public override void Cleanup() { if (SelectedStyleEditor != null) { SelectedStyleEditor.Cleanup(); } SelectedStyleEditor = null; styles = null; selected = null; base.Cleanup(); }
public void IgnoresNotSetProperties() { var set = new StyleSet { Width = 500, Height = 250, }; _processor.Process("block", set).Should().Be(".block{width: 500px;height: 250px;}"); _processor.Process(set).Should().Be("width: 500px;height: 250px;"); }
/// <summary> /// Change the outline pen to a thin black line for all instances /// of this shape. /// </summary> /// <param name="classStyleSet">The style set to modify</param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); IORMFontAndColorService colorService = (Store as IORMToolServices).FontAndColorService; PenSettings settings = new PenSettings(); settings.Color = colorService.GetForeColor(ORMDesignerColor.Constraint); settings.DashStyle = DashStyle.Dash; settings.Width = 1.0F / 72.0F; // 1 Point. 0 Means 1 pixel, but should only be used for non-printed items classStyleSet.OverridePen(DiagramPens.ConnectionLine, settings); settings.Color = colorService.GetBackColor(ORMDesignerColor.ActiveConstraint); classStyleSet.AddPen(ORMDiagram.StickyBackgroundResource, DiagramPens.ConnectionLine, settings); }
/// <summary> /// Initialize a pen and a brush for drawing the constraint /// outlines and contents. /// </summary> /// <param name="classStyleSet">StyleSet</param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); PenSettings penSettings = new PenSettings(); IORMFontAndColorService colorService = (Store as IORMToolServices).FontAndColorService; Color constraintColor = colorService.GetForeColor(ORMDesignerColor.Constraint); penSettings.Color = constraintColor; penSettings.Width = 1.35F / 72.0F; // 1.35 Point. classStyleSet.OverridePen(DiagramPens.ShapeOutline, penSettings); BrushSettings brushSettings = new BrushSettings(); brushSettings.Color = constraintColor; classStyleSet.AddBrush(ExternalConstraintBrush, DiagramBrushes.ShapeBackground, brushSettings); penSettings.Color = colorService.GetBackColor(ORMDesignerColor.ActiveConstraint); classStyleSet.AddPen(ORMDiagram.StickyBackgroundResource, DiagramPens.ShapeOutline, penSettings); }
protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); // Custom Font Settings. // Create a diagram shape text that has been bolded and underlined. var diagram = Diagram; Debug.Assert(diagram != null, "Unable to find instance of Diagram from CompartmentList instance."); if (diagram != null) { var fontSettings = diagram.StyleSet.GetOverriddenFontSettings(DiagramFonts.ShapeText); Debug.Assert(fontSettings != null, "Why Diagram doesn't contains FontSettings for ShapeText?"); if (fontSettings != null) { fontSettings.Bold = true; fontSettings.Underline = true; classStyleSet.AddFont( new StyleSetResourceId(string.Empty, "ShapeTextBoldUnderline"), DiagramFonts.ShapeText, fontSettings); } } }
/// <summary> /// Initializes style set resources for this shape type /// </summary> /// <param name="classStyleSet">The style set for this shape class</param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); // Custom font styles FontSettings fontSettings; fontSettings = new FontSettings(); fontSettings.Style = FontStyle.Bold; fontSettings.Size = 9 / 72.0F; classStyleSet.AddFont(new StyleSetResourceId(string.Empty, "ShapeTextBold9"), DiagramFonts.ShapeText, fontSettings); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // enable Nutiteq SDK logging Log.EnableAll (); // get MapView MapView view = FindViewById<MapView> (Resource.Id.mapView); // define mandatory parameters // Components keeps internal state and parameters for MapView view.Components = new Components (); // define base projection, almost always EPSG3857, but others can be defined also EPSG3857 proj = new EPSG3857 (); // set online base layer with MapQuest Open Tiles view.Layers.BaseLayer = new TMSMapLayer(proj, 0, 18, 0, "http://otile1.mqcdn.com/tiles/1.0.0/osm/", "/", ".png"); /* //set offline base layer from MBTiles file //TODO: set path properly String MbTilePath = "/sdcard/europe-tilemill-mbtiles.sqlite"; view.Layers.BaseLayer = new MBTilesMapLayer (proj, 0, 5, 1, MbTilePath, this); */ // start map view.StartMapping (); // add a marker // define marker style (image, size, color) Bitmap pointMarker = UnscaledBitmapLoader.DecodeResource(Resources, Resource.Drawable.olmarker); MarkerStyle.Builder markerStyleBuilder = new MarkerStyle.Builder (); markerStyleBuilder.SetBitmap (pointMarker); markerStyleBuilder.SetColor (NutiteqComponents.Color.White); markerStyleBuilder.SetSize (0.5f); MarkerStyle markerStyle = markerStyleBuilder.Build (); // define label what is shown when you click on marker Label markerLabel = new DefaultLabel ("San Francisco", "Here is a marker"); // define location of the marker, it must be converted to base map coordinate system MapPos SanFrancisco = view.Layers.BaseLayer.Projection.FromWgs84 (-122.416667f, 37.766667f); MapPos London = view.Layers.BaseLayer.Projection.FromWgs84 (0.0f, 51.0f); // create layer and add object to the layer, finally add layer to the map. // All overlay layers must be same projection as base layer, so we reuse it MarkerLayer markerLayer = new MarkerLayer(view.Layers.BaseLayer.Projection); markerLayer.Add(new Marker(SanFrancisco, markerLabel, markerStyle, markerLayer)); view.Layers.AddLayer(markerLayer); // 3d building layer Polygon3DStyle.Builder nml3dStyleBuilder = new Polygon3DStyle.Builder (); Polygon3DStyle nml3dStyle = nml3dStyleBuilder.Build (); StyleSet nmlStyleSet = new StyleSet (); nmlStyleSet.SetZoomStyle (14, nml3dStyle); NMLModelOnlineLayer Online3dLayer = new NMLModelOnlineLayer (view.Layers.BaseLayer.Projection, "http://aws-lb.nutiteq.ee/nml/nmlserver2.php?data=demo&", nmlStyleSet); // persistent caching settings for the layer Online3dLayer.SetMemoryLimit (20*1024*1024); // 20 MB Online3dLayer.SetPersistentCacheSize (50*1024*1024); // 50 MB Online3dLayer.SetPersistentCachePath ("/sdcard/nmlcache.db"); // mandatory to be set view.Layers.AddLayer(Online3dLayer); // OSM Polygon3D layer Polygon3DStyle.Builder poly3dStyleBuilder = new Polygon3DStyle.Builder (); poly3dStyleBuilder.SetColor (NutiteqComponents.Color.White); Polygon3DStyle poly3dStyle = poly3dStyleBuilder.Build (); StyleSet polyStyleSet = new StyleSet (); polyStyleSet.SetZoomStyle (16, poly3dStyle); Roof DefaultRoof = new FlatRoof (); Polygon3DOSMLayer Poly3DLayer = new Polygon3DOSMLayer (view.Layers.BaseLayer.Projection, 0.3f, DefaultRoof, unchecked((int) 0xffffffff) /* white */, unchecked((int) 0xff888888) /* gray */, 1500, polyStyleSet); view.Layers.AddLayer (Poly3DLayer); // set map center and zoom view.FocusPoint = SanFrancisco; view.Zoom = 5.0f; // set listener for map events MapListener listener = new MyMapListener (); view.Options.MapListener = listener; }
public void ClearAllStyles() { styles = StyleSet.Empty; handler.SetStyles (Backend, styles); }
public void ClearStyle(string style) { if (string.IsNullOrEmpty (style)) throw new ArgumentException ("style can't be empty"); styles = styles.Remove (style); handler.SetStyles (Backend, styles); }
public void Restore() { handler.Restore (Backend); if (contextStack.Count > 0) { var info = contextStack.Pop (); globalAlpha = info.Alpha; if (styles != info.Styles) { styles = info.Styles; handler.SetStyles (Backend, styles); } } }
public override void SetStyles(object backend, StyleSet styles) { var c = (DrawingContext)backend; c.Styles = styles; }
public void SetStyle(string style) { if (string.IsNullOrEmpty (style)) throw new ArgumentException ("style can't be empty"); if (style[0] == '!') styles = styles.Remove (style.Substring (1)); else styles = styles.Add (style); handler.SetStyles (Backend, styles); }
/// <summary> /// Initialize a font for formatting the mandatory attribute contents. /// </summary> /// <param name="classStyleSet">The <see cref="StyleSet"/> being initialized.</param> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); }
/// <summary> /// Initialize a <see cref="StyleSet"/> for rendering deontic constraints. /// The style set is created in <see cref="DeonticClassStyleSet"/> and /// initialized here. /// </summary> /// <remarks>If a derived class does not modify additional resources in the /// default style set, then this method is not required and any derived deontic /// style set can be based on the deontic style set for this base class. However, /// if new resources are introduced, then the derived class should base a /// deontic style set on the derived class style set and reinitialize the /// deontic settings in that style set.</remarks> protected virtual void InitializeDeonticClassStyleSet(StyleSet styleSet) { IORMFontAndColorService colorService = (Store as IORMToolServices).FontAndColorService; Color constraintColor = colorService.GetForeColor(ORMDesignerColor.DeonticConstraint); PenSettings penSettings = new PenSettings(); penSettings.Color = constraintColor; styleSet.OverridePen(DiagramPens.ShapeOutline, penSettings); BrushSettings brushSettings = new BrushSettings(); brushSettings.Color = constraintColor; styleSet.OverrideBrush(ExternalConstraintBrush, brushSettings); }
public override void SetStyles(object backend, StyleSet styles) { var ctx = (VectorBackend)backend; ctx.Commands.Add (DrawingCommand.SetStyles); ctx.Objects.Add (styles); }
public abstract void SetStyles(object backend, StyleSet styles);
public static void SetGlobalStyle(string style) { // Make a copy of the collection since it may be referenced from context instances, // which don't expect the collection to change globalStyles = globalStyles.Add (style); NotifyGlobalStylesChanged (); }
/// <summary> /// Initializes the Resources for the background. /// </summary> private void InitializeBackgroundResources(StyleSet styleSet) { ITailoredBackgroundStyles styles = this.GetBackgroundStyles(); Color gradientStartColor = styles.TitleGradientFillColor; Color gradientEndColor = Color.Transparent; Color selectedColor = gradientStartColor; Color selectedInnactiveColor = gradientStartColor; // Title Text DiagramTitleField.InitializeInstanceResources(styleSet, TitleFontSize, styles.TitleTextColor); // Background color BrushSettings backgroundBrush = new BrushSettings(); backgroundBrush.Color = styles.BackgroundFillColor; styleSet.OverrideBrush(DiagramBrushes.DiagramBackground, backgroundBrush); // Start of title gradient BrushSettings titleGradientBrush = new BrushSettings(); titleGradientBrush.Color = gradientStartColor; styleSet.OverrideBrush(DiagramBrushes.ShapeBackground, titleGradientBrush); // Selected state titleGradientBrush = new BrushSettings(); titleGradientBrush.Color = selectedColor; styleSet.OverrideBrush(DiagramBrushes.ShapeBackgroundSelected, titleGradientBrush); // SelectedInactive state titleGradientBrush = new BrushSettings(); titleGradientBrush.Color = selectedInnactiveColor; styleSet.OverrideBrush(DiagramBrushes.ShapeBackgroundSelectedInactive, titleGradientBrush); // Find the field for the background AreaField background = this.FindShapeField(DiagramBackgroundShapeName) as AreaField; if (background != null) { background.DefaultReflectParentSelectedState = true; background.GradientEndingColor = gradientEndColor; // Constrain the height of the shape background.AnchoringBehavior.SetBottomAnchor(AnchoringBehavior.Edge.Bottom, (this.MaximumSize.Height - GradientHeight)); } }
public static void ClearGlobalStyle(string style) { globalStyles = globalStyles.Remove (style); NotifyGlobalStylesChanged (); }
internal void SetStyles(StyleSet styles) { this.styles = this.styles.AddRange (styles.Intersect (RegisteredStyles).ToArray ()); this.styles = this.styles.RemoveAll (styles.Where (s => s.StartsWith ("-", StringComparison.Ordinal)).Select (s => s.TrimStart ('-')).ToArray ()); handler.SetStyles (Backend, this.styles); }
/// <summary> /// Add error brushes to the styleSet /// </summary> protected override void InitializeResources(StyleSet classStyleSet) { base.InitializeResources(classStyleSet); IORMFontAndColorService colorService = (Store as IORMToolServices).FontAndColorService; BrushSettings brushSettings = new BrushSettings(); //UNDONE: This color isn't permanent. probably want a better color for the errors. brushSettings.ForeColor = Color.LightPink; //brushSettings.ForeColor = colorService.GetForeColor(ORMDesignerColor.ConstraintError); brushSettings.HatchStyle = HatchStyle.LightDownwardDiagonal; brushSettings.BrushType = typeof(HatchBrush); classStyleSet.AddBrush(ORMDiagram.ErrorBackgroundResource, DiagramBrushes.DiagramBackground, brushSettings); brushSettings.ForeColor = ORMDiagram.ModifyLuminosity(brushSettings.ForeColor); brushSettings.BackColor = ORMDiagram.ModifyLuminosity(((SolidBrush)classStyleSet.GetBrush(DiagramBrushes.DiagramBackground)).Color); classStyleSet.AddBrush(ORMDiagram.HighlightedErrorBackgroundResource, DiagramBrushes.DiagramBackground, brushSettings); BrushSettings transBrush = new BrushSettings(); transBrush.ForeColor = Color.Transparent; classStyleSet.AddBrush(ORMDiagram.TransparentBrushResource, DiagramBrushes.DiagramBackground, transBrush); }