Beispiel #1
0
        public override void Bind(IEditorService service)
        {
            _edSvc = service;
            _edSvc.RegisterCustomNotifier(this);
            _sym  = (ISimpleSymbolDefinition)_edSvc.GetEditedResource();
            _rbox = _sym.ResizeBox;
            try
            {
                _init = true;

                chkEnableResizeBox.Checked = (_rbox != null);
                grpResizeBox.Enabled       = chkEnableResizeBox.Checked;

                if (_rbox == null)
                {
                    _rbox = _sym.CreateResizeBox();
                }

                symGrowControl.Items = SymbolField.GetItems <GrowControl>();

                symGrowControl.Bind(_rbox, nameof(_rbox.GrowControl));
                symHeight.Bind(_rbox, nameof(_rbox.SizeY));
                symWidth.Bind(_rbox, nameof(_rbox.SizeX));
                symXCoord.Bind(_rbox, nameof(_rbox.PositionX));
                symYCoord.Bind(_rbox, nameof(_rbox.PositionY));
            }
            finally
            {
                _init = false;
            }
        }
Beispiel #2
0
 public TextDialog(EditorBindableCollapsiblePanel parent, ISimpleSymbolDefinition sym, ITextGraphic text)
 {
     InitializeComponent();
     _ed = parent;
     _sym = sym;
     _text = text;
 }
 public PathDialog(EditorBindableCollapsiblePanel parent, ISimpleSymbolDefinition sym, IPathGraphic path)
 {
     InitializeComponent();
     _ed   = parent;
     _sym  = sym;
     _path = path;
 }
Beispiel #4
0
        public override void Bind(IEditorService service)
        {
            _edSvc = service;
            _edSvc.RegisterCustomNotifier(this);
            _sym = (ISimpleSymbolDefinition)_edSvc.GetEditedResource();
            _rbox = _sym.ResizeBox;
            try
            {
                _init = true;

                chkEnableResizeBox.Checked = (_rbox != null);
                grpResizeBox.Enabled = chkEnableResizeBox.Checked;

                if (_rbox == null)
                    _rbox = _sym.CreateResizeBox();

                symGrowControl.Items = SymbolField.GetItems<GrowControl>();

                symGrowControl.Bind(_rbox, "GrowControl");
                symHeight.Bind(_rbox, "SizeY");
                symWidth.Bind(_rbox, "SizeX");
                symXCoord.Bind(_rbox, "PositionX");
                symYCoord.Bind(_rbox, "PositionY");
            }
            finally
            {
                _init = false;
            }
        }
 public TextDialog(EditorBindableCollapsiblePanel parent, ISimpleSymbolDefinition sym, ITextGraphic text)
 {
     InitializeComponent();
     _ed   = parent;
     _sym  = sym;
     _text = text;
 }
Beispiel #6
0
 public override void Bind(IEditorService service)
 {
     _params.Clear();
     _sym = (ISimpleSymbolDefinition)service.GetEditedResource();
     foreach (var p in _sym.ParameterDefinition.Parameter)
     {
         _params.Add(p);
     }
 }
 public override void Bind(IEditorService service)
 {
     _edSvc = service;
     _params.Clear();
     _sym = (ISimpleSymbolDefinition)service.GetEditedResource();
     foreach (var p in _sym.ParameterDefinition.Parameter)
     {
         _params.Add(p);
     }
 }
        public ISimpleSymbolReferenceBase CreateSimpleSymbol(ISimpleSymbolDefinition sym)
        {
            var s = (SimpleSymbolDefinition)sym;

            s.RemoveSchemaAttributes();
            return(new SimpleSymbol()
            {
                Item = s
            });
        }
Beispiel #9
0
        public override void Bind(IEditorService service)
        {
            service.RegisterCustomNotifier(this);
            _sym = (ISimpleSymbolDefinition)service.GetEditedResource();
            lstGraphics.Items.Clear();

            foreach (var g in _sym.Graphics)
            {
                AddGraphicsItem(g);
            }
        }
        public override void Bind(IEditorService service)
        {
            service.RegisterCustomNotifier(this);
            _sym  = (ISimpleSymbolDefinition)service.GetEditedResource();
            _conn = service.CurrentConnection;
            lstGraphics.Items.Clear();

            foreach (var g in _sym.Graphics)
            {
                AddGraphicsItem(g);
            }
        }
Beispiel #11
0
        public override void Bind(IEditorService service)
        {
            service.RegisterCustomNotifier(this);
            _init  = true;
            _edSvc = service;
            try
            {
                _wmd = (IWatermarkDefinition)service.GetEditedResource();
                _sym = (ISimpleSymbolDefinition)_wmd.Content;

                //NOTE: We are assuming there is only one graphic element here.
                foreach (var g in _sym.Graphics)
                {
                    if (g.Type == GraphicElementType.Text)
                    {
                        _text = (ITextGraphic)g;
                    }
                    else if (g.Type == GraphicElementType.Image)
                    {
                        _image = (IImageGraphic)g;
                    }
                }

                if (_text != null || _image != null)
                {
                    if (_text != null)
                    {
                        rdText.Checked = true;
                    }
                    else if (_image != null)
                    {
                        rdImage.Checked = true;
                    }

                    CheckEditStates();
                }
                else
                {
                    //Text, I choose you
                    rdText.Checked = true;
                    CheckEditStates();

                    _text  = _sym.CreateTextGraphics();
                    _image = _sym.CreateImageGraphics();
                    SetActiveGraphicElement(_text);
                }
            }
            finally
            {
                _init = false;
            }
        }
Beispiel #12
0
        public ImageDialog(EditorBindableCollapsiblePanel parent, IServerConnection conn, ISimpleSymbolDefinition ssd, IImageGraphic image)
        {
            InitializeComponent();
            _ed    = parent;
            _ssd   = ssd;
            _image = image;
            _conn  = conn;
            try
            {
                _init = true;
                if (_image.Item.Type == ImageType.Reference)
                {
                    _imageRef             = (IImageReference)_image.Item;
                    rdResourceRef.Checked = true;
                }
                else
                {
                    _imageInline     = (IInlineImage)_image.Item;
                    rdInline.Checked = true;
                }

                if (_imageRef == null)
                {
                    _imageRef = ssd.CreateImageReference(string.Empty, string.Empty);
                }
                else
                {
                    rdResourceRef.Checked = true;
                }

                if (_imageInline == null)
                {
                    _imageInline = ssd.CreateInlineImage(new byte[0]);
                }
                else
                {
                    rdInline.Checked = true;
                }

                txtResourceId.Text = _imageRef.ResourceId;
                txtResData.Text    = _imageRef.LibraryItemName;

                txtImageBase64.Text = Convert.ToBase64String(_imageInline.Content);
                txtImageBase64.Tag  = _imageInline.Content;

                imageType_CheckedChanged(this, null);
            }
            finally
            {
                _init = false;
            }
        }
        /// <summary>
        /// Defines a parameter for a simple symbol definition
        /// </summary>
        /// <param name="simpleSym"></param>
        /// <param name="identifier"></param>
        /// <param name="defaultValue"></param>
        /// <param name="displayName"></param>
        /// <param name="description"></param>
        /// <param name="dataType"></param>
        /// <returns>The defined parameter</returns>
        public static IParameter DefineParameter(this ISimpleSymbolDefinition simpleSym, string identifier, string defaultValue, string displayName, string description, string dataType)
        {
            Check.NotNull(simpleSym, "simpleSym");
            var p = simpleSym.CreateParameter();

            p.Identifier   = identifier;
            p.DefaultValue = defaultValue;
            p.DisplayName  = displayName;
            p.Description  = description;
            p.DataType     = dataType;
            simpleSym.ParameterDefinition.AddParameter(p);
            return(p);
        }
Beispiel #14
0
        public override void Bind(IEditorService service)
        {
            service.RegisterCustomNotifier(this);
            _init = true;
            _edSvc = service;
            try
            {
                _wmd = (IWatermarkDefinition)service.GetEditedResource();
                _sym = (ISimpleSymbolDefinition)_wmd.Content;

                //NOTE: We are assuming there is only one graphic element here.
                foreach (var g in _sym.Graphics)
                {
                    if (g.Type == GraphicElementType.Text)
                        _text = (ITextGraphic)g;
                    else if (g.Type == GraphicElementType.Image)
                        _image = (IImageGraphic)g;
                }

                if (_text != null || _image != null)
                {
                    if (_text != null)
                        rdText.Checked = true;
                    else if (_image != null)
                        rdImage.Checked = true;

                    CheckEditStates();
                }
                else
                {
                    //Text, I choose you
                    rdText.Checked = true;
                    CheckEditStates();

                    _text = _sym.CreateTextGraphics();
                    _image = _sym.CreateImageGraphics();
                    SetActiveGraphicElement(_text);
                }
            }
            finally
            {
                _init = false;
            }
        }
Beispiel #15
0
        public ImageDialog(EditorBindableCollapsiblePanel parent, IResourceService resSvc, ISimpleSymbolDefinition ssd, IImageGraphic image)
        {
            InitializeComponent();
            _ed = parent;
            _ssd = ssd;
            _image = image;
            _resSvc = resSvc;
            try
            {
                _init = true;
                if (_image.Item.Type == ImageType.Reference)
                {
                    _imageRef = (IImageReference)_image.Item;
                    rdResourceRef.Checked = true;
                }
                else
                {
                    _imageInline = (IInlineImage)_image.Item;
                    rdInline.Checked = true;
                }

                if (_imageRef == null)
                    _imageRef = ssd.CreateImageReference("", "");
                else
                    rdResourceRef.Checked = true;

                if (_imageInline == null)
                    _imageInline = ssd.CreateInlineImage(new byte[0]);
                else
                    rdInline.Checked = true;

                txtResourceId.Text = _imageRef.ResourceId;
                txtResData.Text = _imageRef.LibraryItemName;

                txtImageBase64.Text = Convert.ToBase64String(_imageInline.Content);
                txtImageBase64.Tag = _imageInline.Content;

                imageType_CheckedChanged(this, null);
            }
            finally
            {
                _init = false;
            }
        }
Beispiel #16
0
 /// <summary>
 /// Gets the parameters.
 /// </summary>
 /// <param name="ssym">The ssym.</param>
 /// <returns></returns>
 public static IEnumerable <IParameter> GetParameters(this ISimpleSymbolDefinition ssym)
 {
     Check.ArgumentNotNull(ssym, nameof(ssym));
     return(ssym.ParameterDefinition.Parameter);
 }
        /// <summary>
        /// Validates the simple symbol definition.
        /// </summary>
        /// <param name="ssym">The ssym.</param>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        protected static IEnumerable<ValidationIssue> ValidateSimpleSymbolDefinition(ISimpleSymbolDefinition ssym, ResourceValidationContext context)
        {
            //Check that one geometry usage context has been specified
            if (ssym.AreaUsage == null &&
                ssym.LineUsage == null &&
                ssym.PointUsage == null)
            {
                yield return new ValidationIssue(ssym, ValidationStatus.Error, ValidationStatusCode.Error_SymbolDefinition_NoGeometryUsageContexts, Strings.SSDF_NoGeometryUsageContext);
            }

            //Validate image graphics
            foreach (var graphic in ssym.Graphics)
            {
                if (graphic.Type == GraphicElementType.Image)
                {
                    IImageGraphic image = (IImageGraphic)graphic;
                    if (image.Item != null)
                    {
                        if (image.Item.Type == ImageType.Reference)
                        {
                            IImageReference imgRef = (IImageReference)image.Item;
                            if (!context.ResourceExists(imgRef.ResourceId))
                            {
                                yield return new ValidationIssue(ssym, ValidationStatus.Error, ValidationStatusCode.Error_SymbolDefinition_ImageGraphicReferenceResourceIdNotFound, Strings.SSDF_ImageGraphicReferenceResourceIdNotFound);
                            }
                            else
                            {
                                var res = context.GetResource(imgRef.ResourceId);
                                var resData = res.EnumerateResourceData();
                                bool found = false;
                                foreach (var item in resData)
                                {
                                    if (item.Name == imgRef.LibraryItemName)
                                        found = true;
                                }

                                if (!found)
                                {
                                    yield return new ValidationIssue(ssym,
                                                                     ValidationStatus.Error,
                                                                     ValidationStatusCode.Error_SymbolDefinition_ImageGraphicReferenceResourceDataNotFound,
                                                                     string.Format(Strings.SSDF_ImageGraphicReferenceResourceDataNotFound,
                                                                        imgRef.ResourceId,
                                                                        imgRef.LibraryItemName));
                                }
                            }
                        }
                        else //inline
                        {
                            //TODO: Validate inline image content
                        }
                    }
                }
            }

            string xml = ResourceTypeRegistry.SerializeAsString(ssym);

            //Check non existent symbol parameters
            foreach (var paramDef in ssym.ParameterDefinition.Parameter)
            {
                string name = "%" + paramDef.Identifier + "%"; //NOXLATE
                if (!xml.Contains(name) && string.IsNullOrEmpty(paramDef.DefaultValue))
                {
                    yield return new ValidationIssue(ssym, ValidationStatus.Warning, ValidationStatusCode.Warning_SymbolDefinition_SymbolParameterNotUsed,
                        string.Format(Strings.SSDF_SymbolParameterNotUsed, paramDef.Identifier));
                }
            }

            //TODO: Do the reverse check. Placeholders not pointing to a symbol parameter
        }
Beispiel #18
0
        /// <summary>
        /// Sets the initial state of this editor and sets up any databinding
        /// within such that user interface changes will propagate back to the
        /// model.
        /// </summary>
        /// <param name="service"></param>
        public override void Bind(IEditorService service)
        {
            service.RegisterCustomNotifier(this);
            _sym = (ISimpleSymbolDefinition)service.GetEditedResource();
            _edSvc = service;

            _pu = _sym.PointUsage;
            _lu = _sym.LineUsage;
            _au = _sym.AreaUsage;

            try
            {
                _init = true;

                chkPoint.Checked = (_pu != null);
                chkLine.Checked = (_lu != null);
                chkArea.Checked = (_au != null);

                //Dunno why the event handler is not triggering at this point
                grpPoint.Enabled = chkPoint.Checked;
                grpLine.Enabled = chkLine.Checked;
                grpArea.Enabled = chkArea.Checked;

                if (_pu == null)
                    _pu = _sym.CreatePointUsage();

                if (_lu == null)
                    _lu = _sym.CreateLineUsage();

                if (_au == null)
                    _au = _sym.CreateAreaUsage();

                //Fill the lists fields
                symAreaAngleControl.Items = SymbolField.GetItems<AngleControl>();
                symAreaClippingControl.Items = SymbolField.GetItems<ClippingControl>();
                symAreaOriginControl.Items = SymbolField.GetItems<OriginControl>();
                symLineAngleControl.Items = SymbolField.GetItems<AngleControl>();
                symLineUnitsControl.Items = SymbolField.GetItems<UnitsControl>();
                symLineVertexControl.Items = SymbolField.GetItems<VertexControl>();
                symLineVertexJoin.Items = SymbolField.GetItems<VertexJoin>();
                symPointAngleControl.Items = SymbolField.GetItems<AngleControl>();

                symAreaAngle.Bind(_au, "Angle");
                symAreaAngleControl.Bind(_au, "AngleControl");
                symAreaBufferWidth.Bind(_au, "BufferWidth");
                symAreaClippingControl.Bind(_au, "ClippingControl");
                symAreaOriginControl.Bind(_au, "OriginControl");
                symAreaOriginX.Bind(_au, "OriginX");
                symAreaOriginY.Bind(_au, "OriginY");
                symAreaRepeatX.Bind(_au, "RepeatX");
                symAreaRepeatY.Bind(_au, "RepeatY");

                symLineAngle.Bind(_lu, "Angle");
                symLineAngleControl.Bind(_lu, "AngleControl");
                symLineEndOffset.Bind(_lu, "EndOffset");
                symLineRepeat.Bind(_lu, "Repeat");
                symLineStartOffset.Bind(_lu, "StartOffset");
                symLineUnitsControl.Bind(_lu, "UnitsControl");
                symLineVertexAngleLimit.Bind(_lu, "VertexAngleLimit");
                symLineVertexControl.Bind(_lu, "VertexControl");
                symLineVertexJoin.Bind(_lu, "VertexJoin");
                symLineVertexMiterLimit.Bind(_lu, "VertexMiterLimit");

                symPointAngle.Bind(_pu, "Angle");
                symPointAngleControl.Bind(_pu, "AngleControl");
                symPointOriginOffsetX.Bind(_pu, "OriginOffsetX");
                symPointOriginOffsetY.Bind(_pu, "OriginOffsetY");
            }
            finally
            {
                _init = false;
            }
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="edSvc"></param>
 /// <param name="symDef"></param>
 public SimpleSymbolDefinitionDialog(IEditorService edSvc, ISimpleSymbolDefinition symDef)
 {
     InitializeComponent();
     _edSvc = new SymbolEditorService(edSvc, symDef);
 }
        /// <summary>
        /// Validates the simple symbol definition.
        /// </summary>
        /// <param name="ssym">The ssym.</param>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        protected IEnumerable <ValidationIssue> ValidateSimpleSymbolDefinition(ISimpleSymbolDefinition ssym, ResourceValidationContext context)
        {
            //Check that one geometry usage context has been specified
            if (ssym.AreaUsage == null &&
                ssym.LineUsage == null &&
                ssym.PointUsage == null)
            {
                yield return(new ValidationIssue(ssym, ValidationStatus.Error, ValidationStatusCode.Error_SymbolDefinition_NoGeometryUsageContexts, Strings.SSDF_NoGeometryUsageContext));
            }

            //Validate image graphics
            foreach (var graphic in ssym.Graphics)
            {
                if (graphic.Type == GraphicElementType.Image)
                {
                    IImageGraphic image = (IImageGraphic)graphic;
                    if (image.Item != null)
                    {
                        if (image.Item.Type == ImageType.Reference)
                        {
                            IImageReference imgRef = (IImageReference)image.Item;
                            if (!context.ResourceExists(imgRef.ResourceId))
                            {
                                yield return(new ValidationIssue(ssym, ValidationStatus.Error, ValidationStatusCode.Error_SymbolDefinition_ImageGraphicReferenceResourceIdNotFound, Strings.SSDF_ImageGraphicReferenceResourceIdNotFound));
                            }
                            else
                            {
                                var  res     = context.GetResource(imgRef.ResourceId);
                                var  resData = this.Connection.ResourceService.EnumerateResourceData(res.ResourceID);
                                bool found   = false;
                                foreach (var item in resData.ResourceData)
                                {
                                    if (item.Name == imgRef.LibraryItemName)
                                    {
                                        found = true;
                                    }
                                }

                                if (!found)
                                {
                                    yield return(new ValidationIssue(ssym,
                                                                     ValidationStatus.Error,
                                                                     ValidationStatusCode.Error_SymbolDefinition_ImageGraphicReferenceResourceDataNotFound,
                                                                     string.Format(Strings.SSDF_ImageGraphicReferenceResourceDataNotFound,
                                                                                   imgRef.ResourceId,
                                                                                   imgRef.LibraryItemName)));
                                }
                            }
                        }
                        else //inline
                        {
                            //TODO: Validate inline image content
                        }
                    }
                }
            }

            string xml = ObjectFactory.SerializeAsString(ssym);

            //Check non existent symbol parameters
            foreach (var paramDef in ssym.ParameterDefinition.Parameter)
            {
                string name = "%" + paramDef.Identifier + "%"; //NOXLATE
                if (!xml.Contains(name) && string.IsNullOrEmpty(paramDef.DefaultValue))
                {
                    yield return(new ValidationIssue(ssym, ValidationStatus.Warning, ValidationStatusCode.Warning_SymbolDefinition_SymbolParameterNotUsed,
                                                     string.Format(Strings.SSDF_SymbolParameterNotUsed, paramDef.Identifier)));
                }
            }

            //TODO: Do the reverse check. Placeholders not pointing to a symbol parameter
        }
Beispiel #21
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="edSvc"></param>
 /// <param name="symDef"></param>
 public SimpleSymbolDefinitionDialog(IEditorService edSvc, ISimpleSymbolDefinition symDef)
 {
     InitializeComponent();
     _edSvc = new SymbolEditorService(edSvc, symDef);
 }
        /// <summary>
        /// Sets the initial state of this editor and sets up any databinding
        /// within such that user interface changes will propagate back to the
        /// model.
        /// </summary>
        /// <param name="service"></param>
        public override void Bind(IEditorService service)
        {
            service.RegisterCustomNotifier(this);
            _sym   = (ISimpleSymbolDefinition)service.GetEditedResource();
            _edSvc = service;

            _pu = _sym.PointUsage;
            _lu = _sym.LineUsage;
            _au = _sym.AreaUsage;

            try
            {
                _init = true;

                chkPoint.Checked = (_pu != null);
                chkLine.Checked  = (_lu != null);
                chkArea.Checked  = (_au != null);

                //Dunno why the event handler is not triggering at this point
                grpPoint.Enabled = chkPoint.Checked;
                grpLine.Enabled  = chkLine.Checked;
                grpArea.Enabled  = chkArea.Checked;

                if (_pu == null)
                {
                    _pu = _sym.CreatePointUsage();
                }

                if (_lu == null)
                {
                    _lu = _sym.CreateLineUsage();
                }

                if (_au == null)
                {
                    _au = _sym.CreateAreaUsage();
                }

                //Fill the lists fields
                symAreaAngleControl.Items    = SymbolField.GetItems <AngleControl>();
                symAreaClippingControl.Items = SymbolField.GetItems <ClippingControl>();
                symAreaOriginControl.Items   = SymbolField.GetItems <OriginControl>();
                symLineAngleControl.Items    = SymbolField.GetItems <AngleControl>();
                symLineUnitsControl.Items    = SymbolField.GetItems <UnitsControl>();
                symLineVertexControl.Items   = SymbolField.GetItems <VertexControl>();
                symLineVertexJoin.Items      = SymbolField.GetItems <VertexJoin>();
                symPointAngleControl.Items   = SymbolField.GetItems <AngleControl>();

                symAreaAngle.Bind(_au, nameof(_au.Angle));
                symAreaAngleControl.Bind(_au, nameof(_au.AngleControl));
                symAreaBufferWidth.Bind(_au, nameof(_au.BufferWidth));
                symAreaClippingControl.Bind(_au, nameof(_au.ClippingControl));
                symAreaOriginControl.Bind(_au, nameof(_au.OriginControl));
                symAreaOriginX.Bind(_au, nameof(_au.OriginX));
                symAreaOriginY.Bind(_au, nameof(_au.OriginY));
                symAreaRepeatX.Bind(_au, nameof(_au.RepeatX));
                symAreaRepeatY.Bind(_au, nameof(_au.RepeatY));

                symLineAngle.Bind(_lu, nameof(_lu.Angle));
                symLineAngleControl.Bind(_lu, nameof(_lu.AngleControl));
                symLineEndOffset.Bind(_lu, nameof(_lu.EndOffset));
                symLineRepeat.Bind(_lu, nameof(_lu.Repeat));
                symLineStartOffset.Bind(_lu, nameof(_lu.StartOffset));
                symLineUnitsControl.Bind(_lu, nameof(_lu.UnitsControl));
                symLineVertexAngleLimit.Bind(_lu, nameof(_lu.VertexAngleLimit));
                symLineVertexControl.Bind(_lu, nameof(_lu.VertexControl));
                symLineVertexJoin.Bind(_lu, nameof(_lu.VertexJoin));
                symLineVertexMiterLimit.Bind(_lu, nameof(_lu.VertexMiterLimit));

                symPointAngle.Bind(_pu, nameof(_pu.Angle));
                symPointAngleControl.Bind(_pu, nameof(_pu.AngleControl));
                symPointOriginOffsetX.Bind(_pu, nameof(_pu.OriginOffsetX));
                symPointOriginOffsetY.Bind(_pu, nameof(_pu.OriginOffsetY));
            }
            finally
            {
                _init = false;
            }
        }