Show / Hide Table of Contents

Class CompoundShape

A 2d shape composed by multiple SimpleShape objects. All simple shapes are disjoint.

Inheritance
System.Object
CompoundShape
Implements
System.Runtime.Serialization.ISerializable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: CADability.Shapes
Assembly: CADability.dll
Syntax
[Serializable]
public class CompoundShape : ISerializable

Constructors

| Improve this Doc View Source

CompoundShape()

Constructs an empty shape

Declaration
public CompoundShape()
| Improve this Doc View Source

CompoundShape(SimpleShape[])

Constructs a compund shape from one or many simple shapes. The simple shapes must be non overlapping

note

If you are not sure, whether

Declaration
public CompoundShape(params SimpleShape[] simpleShapes)
Parameters
Type Name Description
SimpleShape[] simpleShapes

the simple shapes

| Improve this Doc View Source

CompoundShape(SerializationInfo, StreamingContext)

Constructor required by deserialization

Declaration
protected CompoundShape(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
System.Runtime.Serialization.SerializationInfo info

SerializationInfo

System.Runtime.Serialization.StreamingContext context

StreamingContext

Properties

| Improve this Doc View Source

Area

Declaration
public double Area { get; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

Empty

Declaration
public bool Empty { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

SimpleShapes

Returns the array of SimpleShape, which define this CompoundShape. In many cases, there is only one SimpleShape.

Declaration
public SimpleShape[] SimpleShapes { get; }
Property Value
Type Description
SimpleShape[]
| Improve this Doc View Source

UserData

Declaration
public UserData UserData { get; }
Property Value
Type Description
UserData

Methods

| Improve this Doc View Source

Approximate(Boolean, Double)

Declaration
public void Approximate(bool linesOnly, double precision)
Parameters
Type Name Description
System.Boolean linesOnly
System.Double precision
| Improve this Doc View Source

Clip(ICurve2D, Boolean)

Declaration
public double[] Clip(ICurve2D toClip, bool returnInsideParts)
Parameters
Type Name Description
ICurve2D toClip
System.Boolean returnInsideParts
Returns
Type Description
System.Double[]
| Improve this Doc View Source

Clone()

Declaration
public CompoundShape Clone()
Returns
Type Description
CompoundShape
| Improve this Doc View Source

Contains(GeoPoint2D, Boolean)

Declaration
public bool Contains(GeoPoint2D p, bool acceptOnCurve)
Parameters
Type Name Description
GeoPoint2D p
System.Boolean acceptOnCurve
Returns
Type Description
System.Boolean
| Improve this Doc View Source

CreateFromConnectedList(GeoObjectList, Plane, GeoPoint2D, Double, ConstrHatchInside.HatchMode)

Creates a CompundShape from the objects in the list. The objects must reside in a common plane. The objects must reside in the provided plane. The innerPoint defines a point which must be inside the shape. The mode gives more control about the desired result.

Declaration
public static CompoundShape CreateFromConnectedList(GeoObjectList TheObjects, Plane plane, GeoPoint2D innerPoint, double maxGap, ConstrHatchInside.HatchMode mode)
Parameters
Type Name Description
GeoObjectList TheObjects

The objects (curves) that build the shape

Plane plane

The plane, in which the objects reside

GeoPoint2D innerPoint

the inner point which acts as a seed to define the shape

System.Double maxGap

The maiximum allowable gap between curves to still consider them as connected.

ConstrHatchInside.HatchMode mode

The mode, ConstrHatchInside.HatchMode

Returns
Type Description
CompoundShape

The shape or null, if no appropriate shape found

| Improve this Doc View Source

CreateFromList(ICurve2D[], Double)

Creates a CompundShape from the curves in this list. Assumes the curves are connected. The outer hull is returned.

Declaration
public static CompoundShape CreateFromList(ICurve2D[] curves2d, double maxGap)
Parameters
Type Name Description
ICurve2D[] curves2d

The curves

System.Double maxGap

Maximum gap between curves

Returns
Type Description
CompoundShape

The shape

| Improve this Doc View Source

CreateFromList(ICurve2D[], Double, out GeoObjectList)

Creates a CompundShape from the curves in this list. Assumes the curves are connected. The outer hull is returned.

Declaration
public static CompoundShape CreateFromList(ICurve2D[] curves2d, double maxGap, out GeoObjectList deadObjectList)
Parameters
Type Name Description
ICurve2D[] curves2d

The curves

System.Double maxGap

Maximum gap between curves

GeoObjectList deadObjectList

List of objects that could not be used to build a CompoundShape

Returns
Type Description
CompoundShape

The shape

| Improve this Doc View Source

CreateFromList(GeoObjectList, GeoPoint, Boolean, Boolean, Double, out Plane)

Creates a CompundShape from the objects in the list. The objects must reside in a common plane. Only the shape that encloses the inner point is created. If excludeHoles is true, The resulting shape may contain holes.

Declaration
public static CompoundShape CreateFromList(GeoObjectList TheObjects, GeoPoint innerPoint, bool connected, bool excludeHoles, double maxGap, out Plane plane)
Parameters
Type Name Description
GeoObjectList TheObjects

The curves to make the shape from

GeoPoint innerPoint

The inner point to define which shape is to be created

System.Boolean connected

True: the curves are already connected (faster performance), false: the curves may overlap or intersect

System.Boolean excludeHoles

True: exclude all holes that are inside the outer shape, false: return only the outer shape

System.Double maxGap

Maximum gap between curves

Plane plane

The common plane and the location of the shape in 3d space

Returns
Type Description
CompoundShape

The shape or null, if no appropriate shape found

| Improve this Doc View Source

CreateFromList(GeoObjectList, Double, out Plane)

Creates a CompundShape from the objects in the list. The objects must reside in a common plane.

Declaration
public static CompoundShape CreateFromList(GeoObjectList TheObjects, double maxGap, out Plane plane)
Parameters
Type Name Description
GeoObjectList TheObjects

The objects to be connected to a shape

System.Double maxGap

Maximum gap between curves

Plane plane

The common plane and the location of the shape in 3d space

Returns
Type Description
CompoundShape

The shape, may be null if no shape could be created

| Improve this Doc View Source

CreateGraphicsPath()

Declaration
public GraphicsPath CreateGraphicsPath()
Returns
Type Description
System.Drawing.Drawing2D.GraphicsPath
| Improve this Doc View Source

Difference(CompoundShape, CompoundShape)

Declaration
public static CompoundShape Difference(CompoundShape s1, CompoundShape s2)
Parameters
Type Name Description
CompoundShape s1
CompoundShape s2
Returns
Type Description
CompoundShape
| Improve this Doc View Source

Difference(CompoundShape, CompoundShape, Double)

Declaration
public static CompoundShape Difference(CompoundShape s1, CompoundShape s2, double precision)
Parameters
Type Name Description
CompoundShape s1
CompoundShape s2
System.Double precision
Returns
Type Description
CompoundShape
| Improve this Doc View Source

Expand(Double)

Declaration
public CompoundShape Expand(double d)
Parameters
Type Name Description
System.Double d
Returns
Type Description
CompoundShape
| Improve this Doc View Source

FromSingleOutline(ICurve2D[], Double)

Declaration
public static CompoundShape FromSingleOutline(ICurve2D[] curves, double maxGap)
Parameters
Type Name Description
ICurve2D[] curves
System.Double maxGap
Returns
Type Description
CompoundShape
| Improve this Doc View Source

GetDisplayExtent(Double)

Declaration
public BoundingRect GetDisplayExtent(double WorldToPixel)
Parameters
Type Name Description
System.Double WorldToPixel
Returns
Type Description
BoundingRect
| Improve this Doc View Source

GetExtent()

Declaration
public BoundingRect GetExtent()
Returns
Type Description
BoundingRect
| Improve this Doc View Source

GetModified(ModOp2D)

Declaration
public CompoundShape GetModified(ModOp2D m)
Parameters
Type Name Description
ModOp2D m
Returns
Type Description
CompoundShape
| Improve this Doc View Source

GetObjectData(SerializationInfo, StreamingContext)

Implements System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)

Declaration
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
System.Runtime.Serialization.SerializationInfo info

The System.Runtime.Serialization.SerializationInfo to populate with data.

System.Runtime.Serialization.StreamingContext context

The destination (System.Runtime.Serialization.StreamingContext) for this serialization.

| Improve this Doc View Source

GetSingleOutline()

Declaration
public Path2D GetSingleOutline()
Returns
Type Description
Path2D
| Improve this Doc View Source

HitTest(ref BoundingRect)

Declaration
public bool HitTest(ref BoundingRect Rect)
Parameters
Type Name Description
BoundingRect Rect
Returns
Type Description
System.Boolean
| Improve this Doc View Source

HitTest(ref BoundingRect, Boolean)

Declaration
public bool HitTest(ref BoundingRect Rect, bool IncludeControlPoints)
Parameters
Type Name Description
BoundingRect Rect
System.Boolean IncludeControlPoints
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Intersection(CompoundShape, CompoundShape)

Declaration
public static CompoundShape Intersection(CompoundShape s1, CompoundShape s2)
Parameters
Type Name Description
CompoundShape s1
CompoundShape s2
Returns
Type Description
CompoundShape
| Improve this Doc View Source

Intersection(CompoundShape, CompoundShape, Double)

Declaration
public static CompoundShape Intersection(CompoundShape s1, CompoundShape s2, double precision)
Parameters
Type Name Description
CompoundShape s1
CompoundShape s2
System.Double precision
Returns
Type Description
CompoundShape
| Improve this Doc View Source

MakeFaces(Plane)

Returns planar faces, one for each contained SimpleShape.

Declaration
public Face[] MakeFaces(Plane plane)
Parameters
Type Name Description
Plane plane

Plane where to construct the faces

Returns
Type Description
Face[]

Array of faces

| Improve this Doc View Source

MakePaths(Plane)

Converts the shape to one or more Path objects according to the provided plane.

Declaration
public Path[] MakePaths(Plane plane)
Parameters
Type Name Description
Plane plane

Plane in 3D space where the shape should be located

Returns
Type Description
Path[]

The resulting path(s)

| Improve this Doc View Source

Project(Plane, Plane)

The 2d-compund shape is assumed to reside in plane "fromPlane". It will be projected perpendicular onto the plane "toPlane". If the planes are perpendicular, the result will be am empty shape

Declaration
public CompoundShape Project(Plane fromPlane, Plane toPlane)
Parameters
Type Name Description
Plane fromPlane

the containing plane

Plane toPlane

the projection plane

Returns
Type Description
CompoundShape

the projected shape

| Improve this Doc View Source

Shrink(Double)

Declaration
public CompoundShape Shrink(double d)
Parameters
Type Name Description
System.Double d
Returns
Type Description
CompoundShape
| Improve this Doc View Source

Split(Border)

Das im Parameter gegebene Objekt muss eine offene Kurve sein, die dieses CompoundShape Objekt durchschneidet. Das Ergebniss ist ein CompoundShape, was aus mehreren SimpleShapes besteht, die durch das Durchschneiden entstanden sind.

Declaration
public CompoundShape Split(Border ToSplitWith)
Parameters
Type Name Description
Border ToSplitWith
Returns
Type Description
CompoundShape
| Improve this Doc View Source

Union(CompoundShape, CompoundShape)

Declaration
public static CompoundShape Union(CompoundShape s1, CompoundShape s2)
Parameters
Type Name Description
CompoundShape s1
CompoundShape s2
Returns
Type Description
CompoundShape
| Improve this Doc View Source

Union(CompoundShape, CompoundShape, Double)

Declaration
public static CompoundShape Union(CompoundShape s1, CompoundShape s2, double precision)
Parameters
Type Name Description
CompoundShape s1
CompoundShape s2
System.Double precision
Returns
Type Description
CompoundShape

Operators

| Improve this Doc View Source

Addition(CompoundShape, CompoundShape)

Declaration
public static CompoundShape operator +(CompoundShape s1, CompoundShape s2)
Parameters
Type Name Description
CompoundShape s1
CompoundShape s2
Returns
Type Description
CompoundShape
| Improve this Doc View Source

Multiply(CompoundShape, CompoundShape)

Declaration
public static CompoundShape operator *(CompoundShape s1, CompoundShape s2)
Parameters
Type Name Description
CompoundShape s1
CompoundShape s2
Returns
Type Description
CompoundShape
| Improve this Doc View Source

Subtraction(CompoundShape, CompoundShape)

Returns the difference of the two CompoundShapes s1 and s2 (s1-s2). The result may be empty.

Declaration
public static CompoundShape operator -(CompoundShape s1, CompoundShape s2)
Parameters
Type Name Description
CompoundShape s1

first operand

CompoundShape s2

second operand

Returns
Type Description
CompoundShape

difference

Implements

System.Runtime.Serialization.ISerializable
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX