com.aspose.diagram

  • java.lang.Object
    • com.aspose.diagram.Shape
public class Shape 
extends java.lang.Object

Contains elements that define a shape in a Master, Page, or group shape element.

Constructor Summary
Shape()
Constructor.
 
Property Getters/Setters Summary
Aspose.Diagram.ActiveXControls.ActiveXControlgetActiveXControl()
Gets the ActiveX control.
ActCollectiongetActs()
Contains a collection of Act elements.
AligngetAlign()
Indicates the alignment of a shape with respect to the guide or guide point to which the shape is glued. The Align element appears only for shapes that are glued to guides or guide points.
CharCollectiongetChars()
Contains a collection of Char elements.
ConnectionABCDCollectiongetConnectionABCDs()
Contains a collection of ConnectionABCD elements.
ConnectionCollectiongetConnections()
Contains a collection of Connection elements.
byte[]getControlData()
Gets the data of control.
ControlCollectiongetControls()
Contains a collection of Control elements.
java.lang.StringgetData1()
void
setData1(java.lang.Stringvalue)
           Contains an arbitrary string value that is used to supply additional information about a shape.
java.lang.StringgetData2()
void
setData2(java.lang.Stringvalue)
           Contains an arbitrary string value that is used to supply additional information about a shape.
java.lang.StringgetData3()
void
setData3(java.lang.Stringvalue)
           Contains an arbitrary string value that is used to supply additional information about a shape.
intgetDel()
void
setDel(intvalue)
           A flag indicating whether the element is deleted locally. A value of 1 indicates that the element is deleted locally. The value of the property is BOOL integer constant.
DiagramgetDiagram()
void
           Root element of Visio objects hierarchy.
EventgetEvent()
void
setEvent(Event value)
           Contains elements that specify formulas that control shape events.
FieldCollectiongetFields()
Contains a collection of Field elements.
FillgetFill()
Contains the current fill formatting values for the shape and the shape's drop shadow, including pattern, foreground color, and background color.
StyleSheetgetFillStyle()
void
           StyleSheet from which this shape inherits fill formatting.
ForeigngetForeign()
Contains elements specifying the width and height of an object from another program used in a Microsoft Visio document. Also includes elements specifying the distance the object's image is offset within its borders.
ForeignDatagetForeignData()
Contains a MIME (Multipurpose Internet Mail Extensions) encoded BLOB of picture data, such as Windows metafile, bitmap, or OLE data.
GeomCollectiongetGeoms()
Contains a collection of Geom elements.
GroupgetGroup()
Contains elements that control how you add shapes to a group, move members of a group, and select groups.
HelpgetHelp()
Contains elements specifying the Shape element's Help file topic and copyright information.
HyperlinkCollectiongetHyperlinks()
Contains a collection of Hyperlink elements.
longgetID()
void
setID(longvalue)
           The unique ID of the element within its parent element.
ImagegetImage()
Contains the gamma, brightness, contrast, blur, sharpen, denoise, and transparency values for a bitmap.
CharCollectiongetInheritChars()
Contains the char values for the shape inherit by the master shape.
FillgetInheritFill()
Contains the fill formatting values for the shape inherit by the parent style and the master shape.
LinegetInheritLine()
Contains the line formatting values for the shape inherit by the parent style and the master shape.
PropCollectiongetInheritProps()
Contains the props for the shape inherit by the master shape.
booleanisTextEmpty()
Indicate the shape has text and the text is empty or not.
LayerMemgetLayerMem()
Contains the LayerMember element, which specifies each layer to which the shape is assigned.
LayoutgetLayout()
Contains elements that control shape placement and connector routing settings.
LinegetLine()
Contains elements that control line attributes for a shape, such as pattern, weight, and color. These elements determine whether the line ends are formatted (for example, with an arrowhead), the size of line end formats, radius of the rounding circle applied to the line, and line cap style (round or square).
StyleSheetgetLineStyle()
void
           StyleSheet from which this shape inherits line formatting
MastergetMaster()
void
           The Master from which the shape inherits its data.
ShapegetMasterShape()
void
           This attribute may only be present in shapes that are members of a group shape, and the group is an instance of a master. The attribute contains an ID that references the corresponding sub-shape in the master.
MiscgetMisc()
Contains elements specifying the Shape element's Help file topic and copyright information.
java.lang.StringgetName()
void
setName(java.lang.Stringvalue)
           The name of the element.
java.lang.StringgetNameU()
void
setNameU(java.lang.Stringvalue)
           The universal name of the element.
booleangetOneD()
Determines whether the shape behaves as a one-dimensional (1-D) object. Read-only.
PagegetPage()
void
setPage(Page value)
           Root element of Visio objects hierarchy.
ParaCollectiongetParas()
Contains a collection of Para elements.
ShapegetParentShape()
void
           Shape's parent.
PropCollectiongetProps()
void
           Contains a collection of Prop elements.
ProtectiongetProtection()
Locking helps prevent inadvertent changes to the shape but does not prevent Microsoft Visio from resetting values in other circumstances. It also does not protect against changes made in the ShapeSheet window.
ScratchCollectiongetScratchs()
Contains a collection of Scratch elements.
ShapeCollectiongetShapes()
Contains a collection of Shape elements.
SmartTagDefCollectiongetSmartTagDefs()
Contains a collection of SmartTagDef elements.
TabsCollectiongetTabsCollection()
Contains a collection of Tab elements.
TextgetText()
void
setText(Text value)
           Contains the text of a shape.
TextBlockgetTextBlock()
Contains elements that specify the alignment, margins, and default tab stop positions of text in a shape's text block.
StyleSheetgetTextStyle()
void
           StyleSheet from which this shape inherits text formatting.
TextXFormgetTextXForm()
Contains elements that specify positioning information about a shape's text block.
ThreeDFormatgetThreeDFormat()
Gets the ThreeDFormat.
booleangetTwoD()
void
setTwoD(booleanvalue)
           Determines whether the shape behaves as a two-dimensional (2-D) object.
intgetType()
void
setType(intvalue)
           The type of a shape. It may be one of the following values: Group, Shape, Guide, or Foreign. The value of the property is TypeValue integer constant.
java.util.UUIDgetUniqueID()
A GUID (globally unique identifier) assigned to the shape.
UserCollectiongetUsers()
Contains a collection of User elements.
XFormgetXForm()
void
setXForm(XForm value)
           Contains elements specifying general positioning information about a shape.
XForm1DgetXForm1D()
void
           Contains x- and y-coordinates of the begin point and end point of a 1-D shape. This element appears for 1-D shapes only.
intgetZOrderIndex()
Returns the index of a shape in the z-order except the guide shape.
 
Method Summary
voidbringForward()
Brings the shape forward one position in the z-order.
voidbringToFront()
Brings the shape to the front of the z-order.
long[]connectedShapes(int flag, java.lang.String categoryFilter)
Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape.
voidcopy(Shape source)
intgetConnectorsType()
Get Connectors type
long[]gluedShapes(int flag, java.lang.String categoryFilter, Shape otherShape)
Returns an array that contains the identifiers of the shapes that are glued to a shape.
booleanisConnected(Shape shape)
Indicates whether this two shapes are connected.
booleanisGlued(Shape shape)
Indicates whether this two shapes are glued.
booleanisInGroup()
Indicates whether this shape is in a group shape.
voidmove(double dX, double dY)
Moves shape on the dX and dY inches from current position.
voidmoveTo(double newPinX, double newPinY)
Moves shape on new absolute position on the page.
voidrefreshData()
Refreshes shape's position including xform ,connection and geom when changing shape's text or other's .
voidsendBackward()
Moves the shape back one position in the z-order.
voidsendToBack()
Moves the shape to the back of the z-order.
voidsetAngle(double angle)
Sets new angle of shape. The angle's unit is radian.
voidsetConnectorsType(int type)
Set Connectors type
voidsetHeight(double height)
Sets new height of shape.
voidsetWidth(double width)
Sets new width of shape.
voidtoHTML(java.io.OutputStream stream, HTMLSaveOptions options)
Creates the shape html and saves it to a stream in the specified format.
voidtoHTML(java.lang.String fileName, HTMLSaveOptions options)
Creates the html and saves it to a file.
voidtoImage(java.io.OutputStream stream, ImageSaveOptions options)
Creates the shape image and saves it to a stream in the specified format.
voidtoImage(java.lang.String imageFile, ImageSaveOptions options)
Creates the shape image and saves it to a file. The extension of the file name determines the format of the image.
voidtoPdf(java.io.OutputStream stream)
Creates the shape pdf and saves it to a stream.
voidtoPdf(java.lang.String fileName)
Saves the shape to a pdf file.
voidtoSvg(java.lang.String imageFile, SVGSaveOptions options)
Saves the shape to a svg file.
 

    • Constructor Detail

      • Shape

        public Shape()
        Constructor.
    • Property Getters/Setters Detail

      • getID/setID

        public long getID() / public void setID(long value)
        
        The unique ID of the element within its parent element.
      • getDel/setDel

        public int getDel() / public void setDel(int value)
        
        A flag indicating whether the element is deleted locally. A value of 1 indicates that the element is deleted locally. The value of the property is BOOL integer constant.
      • getUniqueID

        public java.util.UUID getUniqueID()
        
        A GUID (globally unique identifier) assigned to the shape.
      • getName/setName

        public java.lang.String getName() / public void setName(java.lang.String value)
        
        The name of the element.
      • getNameU/setNameU

        public java.lang.String getNameU() / public void setNameU(java.lang.String value)
        
        The universal name of the element.
      • getType/setType

        public int getType() / public void setType(int value)
        
        The type of a shape. It may be one of the following values: Group, Shape, Guide, or Foreign. The value of the property is TypeValue integer constant.
      • getLineStyle/setLineStyle

        public StyleSheet getLineStyle() / public void setLineStyle(StyleSheet value)
        
        StyleSheet from which this shape inherits line formatting
      • getFillStyle/setFillStyle

        public StyleSheet getFillStyle() / public void setFillStyle(StyleSheet value)
        
        StyleSheet from which this shape inherits fill formatting.
      • getTextStyle/setTextStyle

        public StyleSheet getTextStyle() / public void setTextStyle(StyleSheet value)
        
        StyleSheet from which this shape inherits text formatting.
      • getShapes

        public ShapeCollection getShapes()
        
        Contains a collection of Shape elements.
      • getText/setText

        public Text getText() / public void setText(Text value)
        
        Contains the text of a shape.
      • getXForm/setXForm

        public XForm getXForm() / public void setXForm(XForm value)
        
        Contains elements specifying general positioning information about a shape.
      • getLine

        public Line getLine()
        
        Contains elements that control line attributes for a shape, such as pattern, weight, and color. These elements determine whether the line ends are formatted (for example, with an arrowhead), the size of line end formats, radius of the rounding circle applied to the line, and line cap style (round or square).
      • getFill

        public Fill getFill()
        
        Contains the current fill formatting values for the shape and the shape's drop shadow, including pattern, foreground color, and background color.
      • getInheritChars

        public CharCollection getInheritChars()
        
        Contains the char values for the shape inherit by the master shape.
      • getInheritProps

        public PropCollection getInheritProps()
        
        Contains the props for the shape inherit by the master shape.
      • getInheritLine

        public Line getInheritLine()
        
        Contains the line formatting values for the shape inherit by the parent style and the master shape.
      • getInheritFill

        public Fill getInheritFill()
        
        Contains the fill formatting values for the shape inherit by the parent style and the master shape.
      • getXForm1D/setXForm1D

        public XForm1D getXForm1D() / public void setXForm1D(XForm1D value)
        
        Contains x- and y-coordinates of the begin point and end point of a 1-D shape. This element appears for 1-D shapes only.
      • getEvent/setEvent

        public Event getEvent() / public void setEvent(Event value)
        
        Contains elements that specify formulas that control shape events.
      • getLayerMem

        public LayerMem getLayerMem()
        
        Contains the LayerMember element, which specifies each layer to which the shape is assigned.
      • getForeign

        public Foreign getForeign()
        
        Contains elements specifying the width and height of an object from another program used in a Microsoft Visio document. Also includes elements specifying the distance the object's image is offset within its borders.
      • getTextBlock

        public TextBlock getTextBlock()
        
        Contains elements that specify the alignment, margins, and default tab stop positions of text in a shape's text block.
      • getTextXForm

        public TextXForm getTextXForm()
        
        Contains elements that specify positioning information about a shape's text block.
      • getAlign

        public Align getAlign()
        
        Indicates the alignment of a shape with respect to the guide or guide point to which the shape is glued. The Align element appears only for shapes that are glued to guides or guide points.
      • getProtection

        public Protection getProtection()
        
        Locking helps prevent inadvertent changes to the shape but does not prevent Microsoft Visio from resetting values in other circumstances. It also does not protect against changes made in the ShapeSheet window.
      • getHelp

        public Help getHelp()
        
        Contains elements specifying the Shape element's Help file topic and copyright information.
      • getMisc

        public Misc getMisc()
        
        Contains elements specifying the Shape element's Help file topic and copyright information.
      • getImage

        public Image getImage()
        
        Contains the gamma, brightness, contrast, blur, sharpen, denoise, and transparency values for a bitmap.
      • getGroup

        public Group getGroup()
        
        Contains elements that control how you add shapes to a group, move members of a group, and select groups.
      • getLayout

        public Layout getLayout()
        
        Contains elements that control shape placement and connector routing settings.
      • getChars

        public CharCollection getChars()
        
        Contains a collection of Char elements.
      • getParas

        public ParaCollection getParas()
        
        Contains a collection of Para elements.
      • getScratchs

        public ScratchCollection getScratchs()
        
        Contains a collection of Scratch elements.
      • getConnections

        public ConnectionCollection getConnections()
        
        Contains a collection of Connection elements.
      • getConnectionABCDs

        public ConnectionABCDCollection getConnectionABCDs()
        
        Contains a collection of ConnectionABCD elements.
      • getFields

        public FieldCollection getFields()
        
        Contains a collection of Field elements.
      • getControls

        public ControlCollection getControls()
        
        Contains a collection of Control elements.
      • getGeoms

        public GeomCollection getGeoms()
        
        Contains a collection of Geom elements.
      • getActs

        public ActCollection getActs()
        
        Contains a collection of Act elements.
      • getUsers

        public UserCollection getUsers()
        
        Contains a collection of User elements.
      • getProps/setProps

        public PropCollection getProps() / public void setProps(PropCollection value)
        
        Contains a collection of Prop elements.
      • getHyperlinks

        public HyperlinkCollection getHyperlinks()
        
        Contains a collection of Hyperlink elements.
      • getSmartTagDefs

        public SmartTagDefCollection getSmartTagDefs()
        
        Contains a collection of SmartTagDef elements.
      • getTabsCollection

        public TabsCollection getTabsCollection()
        
        Contains a collection of Tab elements.
      • getData1/setData1

        public java.lang.String getData1() / public void setData1(java.lang.String value)
        
        Contains an arbitrary string value that is used to supply additional information about a shape.
      • getData2/setData2

        public java.lang.String getData2() / public void setData2(java.lang.String value)
        
        Contains an arbitrary string value that is used to supply additional information about a shape.
      • getData3/setData3

        public java.lang.String getData3() / public void setData3(java.lang.String value)
        
        Contains an arbitrary string value that is used to supply additional information about a shape.
      • getForeignData

        public ForeignData getForeignData()
        
        Contains a MIME (Multipurpose Internet Mail Extensions) encoded BLOB of picture data, such as Windows metafile, bitmap, or OLE data.
      • getMasterShape/setMasterShape

        public Shape getMasterShape() / public void setMasterShape(Shape value)
        
        This attribute may only be present in shapes that are members of a group shape, and the group is an instance of a master. The attribute contains an ID that references the corresponding sub-shape in the master.
      • getMaster/setMaster

        public Master getMaster() / public void setMaster(Master value)
        
        The Master from which the shape inherits its data.
      • getParentShape/setParentShape

        public Shape getParentShape() / public void setParentShape(Shape value)
        
        Shape's parent.
      • getDiagram/setDiagram

        public Diagram getDiagram() / public void setDiagram(Diagram value)
        
        Root element of Visio objects hierarchy.
      • getPage/setPage

        public Page getPage() / public void setPage(Page value)
        
        Root element of Visio objects hierarchy.
      • getOneD

        public boolean getOneD()
        
        Determines whether the shape behaves as a one-dimensional (1-D) object. Read-only.
      • getTwoD/setTwoD

        public boolean getTwoD() / public void setTwoD(boolean value)
        
        Determines whether the shape behaves as a two-dimensional (2-D) object.
      • isTextEmpty

        public boolean isTextEmpty()
        
        Indicate the shape has text and the text is empty or not.
      • getControlData

        public byte[] getControlData()
        
        Gets the data of control.
      • getActiveXControl

        public Aspose.Diagram.ActiveXControls.ActiveXControl getActiveXControl()
        
        Gets the ActiveX control.
      • getZOrderIndex

        public int getZOrderIndex()
        
        Returns the index of a shape in the z-order except the guide shape.
      • getThreeDFormat

        public ThreeDFormat getThreeDFormat()
        
        Gets the ThreeDFormat.
    • Method Detail

      • toPdf

        public void toPdf(java.io.OutputStream stream)
                  throws java.lang.Exception
        Creates the shape pdf and saves it to a stream.
        Parameters:
        stream - The output stream.
      • toPdf

        public void toPdf(java.lang.String fileName)
                  throws java.lang.Exception
        Saves the shape to a pdf file.
        Parameters:
        fileName - the pdf file name with full path
      • toImage

        public void toImage(java.lang.String imageFile, ImageSaveOptions options)
                    throws java.lang.Exception
        Creates the shape image and saves it to a file. The extension of the file name determines the format of the image.

        The format of the image is specified by using the extension of the file name. For example, if you specify "myfile.png", then the image will be saved in the PNG format. The following file extensions are recognized: .bmp, .gif, .png, .jpg, .jpeg, .tiff, .tif, .emf.

        Parameters:
        imageFile - The image file name with full path.
        options - Addtional image creation options
      • toImage

        public void toImage(java.io.OutputStream stream, ImageSaveOptions options)
                    throws java.lang.Exception
        Creates the shape image and saves it to a stream in the specified format.
        Parameters:
        stream - The output stream.
        options - Addtional image creation options
      • toSvg

        public void toSvg(java.lang.String imageFile, SVGSaveOptions options)
                  throws java.lang.Exception
        Saves the shape to a svg file.
        Parameters:
        fileName - the svg file name with full path
      • toHTML

        public void toHTML(java.lang.String fileName, HTMLSaveOptions options)
                   throws java.lang.Exception
        Creates the html and saves it to a file.
        Parameters:
        imageFile - The file name with full path.
        options - html save options
      • toHTML

        public void toHTML(java.io.OutputStream stream, HTMLSaveOptions options)
                   throws java.lang.Exception
        Creates the shape html and saves it to a stream in the specified format.
        Parameters:
        stream - The output stream.
        options - Addtional html creation options
      • getConnectorsType

        public int getConnectorsType()
        Get Connectors type
      • setConnectorsType

        public void setConnectorsType(int type)
        Set Connectors type
        Parameters:
        type - A ConnectorsTypeValue value.
      • copy

        public void copy(Shape source)
                 throws java.lang.Exception
      • bringForward

        public void bringForward()
                         throws java.lang.Exception
        Brings the shape forward one position in the z-order.
      • sendBackward

        public void sendBackward()
                         throws java.lang.Exception
        Moves the shape back one position in the z-order.
      • bringToFront

        public void bringToFront()
        Brings the shape to the front of the z-order.
      • sendToBack

        public void sendToBack()
        Moves the shape to the back of the z-order.
      • connectedShapes

        public long[] connectedShapes(int flag, java.lang.String categoryFilter)
                              throws java.lang.Exception
        Returns an array that contains the identifiers (IDs) of the shapes that are connected to the shape.
        Parameters:
        flag - A ConnectedShapesFlags value. Filters the array of returned shape IDs by the directionality of the connectors. See Remarks for possible valuesConnectedShapesFlags.
        categoryFilter - Filters the array of returned shape IDs by limiting it to the IDs of shapes that match the specified categoryjava.lang.String.
        Returns:
        IDs arraylong.
      • isInGroup

        public boolean isInGroup()
        Indicates whether this shape is in a group shape.
      • isConnected

        public boolean isConnected(Shape shape)
                           throws java.lang.Exception
        Indicates whether this two shapes are connected.
        Parameters:
        shape - shape
      • isGlued

        public boolean isGlued(Shape shape)
                       throws java.lang.Exception
        Indicates whether this two shapes are glued.
        Parameters:
        shape - shape
      • refreshData

        public void refreshData()
                        throws java.lang.Exception
        Refreshes shape's position including xform ,connection and geom when changing shape's text or other's . We will gather shape's data such as shape's text then calculate shape's position. This method is only used to refresh shape's data .
      • gluedShapes

        public long[] gluedShapes(int flag, java.lang.String categoryFilter, Shape otherShape)
                          throws java.lang.Exception
        Returns an array that contains the identifiers of the shapes that are glued to a shape.
        Parameters:
        flag - A GluedShapesFlags value. The dimensionality and directionality of the connection points of the shapes to return.See Remarks for possible valuesGluedShapesFlags.
        categoryFilter - Filters the array of returned shape IDs by limiting it to the IDs of shapes that match the specified categoryjava.lang.String.
        otherShape - Optional: additional shape to which returned shapes must also be glued, can be Shape or null.
        Returns:
        IDs arraylong.
      • setWidth

        public void setWidth(double width)
                     throws java.lang.Exception
        Sets new width of shape.
        Parameters:
        width - New widthdouble.
      • setHeight

        public void setHeight(double height)
                      throws java.lang.Exception
        Sets new height of shape.
        Parameters:
        height - New heigthdouble.
      • setAngle

        public void setAngle(double angle)
                     throws java.lang.Exception
        Sets new angle of shape. The angle's unit is radian.
        Parameters:
        angle - New angle which unit is radian not degreedouble.
      • moveTo

        public void moveTo(double newPinX, double newPinY)
                   throws java.lang.Exception
        Moves shape on new absolute position on the page.
        Parameters:
        newPinX - New x-coordinate of the shape's pin (center of rotation) in relation to the origin of its parent.double.
        newPinY - New y-coordinate of the shape's pin (center of rotation) in relation to the origin of its parent.double.
      • move

        public void move(double dX, double dY)
                 throws java.lang.Exception
        Moves shape on the dX and dY inches from current position.
        Parameters:
        dX - X offsetdouble.
        dY - Y offsetdouble.