/// <summary> /// Creates square map item. /// </summary> /// <param name="definition">The square map item definition used to create square map item.</param> /// <returns>Newly created square map item if possible, otherwise null.</returns> public ISquareMapItemElement CreateSquareMapItem(SquareMapItemDefinition definition) { ISquareMapItemElement element = null; if (definition != null) { element = this.CreateSquareMapItem(); if (element != null) { element.FromDefinition(definition); } } return element; }
/// <summary> /// Applies definition to square map item. /// </summary> /// <param name="definition">The square map item definition to apply from.</param> public void FromDefinition(SquareMapItemDefinition definition) { if (definition != null) { /* we have to recreate square here because the type of square acually * changes the class of square as well. * */ IElementService elements = this.GetElementService(); if (elements != null) { this.square = elements.CreateSquare(definition.Square); this.position = definition.Position; } } }