Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
Protos
Nomad 3D
nomad-3d-commons
Commits
b5a41379
Commit
b5a41379
authored
Jun 13, 2017
by
Ivan Dages
Browse files
mate entity : doc
parent
f2e08eac
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/ill/ics/n3d/model/MateEntity.java
View file @
b5a41379
/**
*
*/
package
fr.ill.ics.n3d.model
;
import
javafx.geometry.Point3D
;
import
javafx.scene.transform.Transform
;
/**
* Class representing an entity constrained by a mate.
* @see <a
* href="http://help.solidworks.com/2015/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IMateEntity2~EntityParams.html">
* SolidWorks documentation </a>
* @author dages
*
*/
public
class
MateEntity
{
/**
* Type of an entity.
* These types are a subset of SolidWorks mate entities types.
* @author dages
*/
public
enum
Type
{
/** Point constraint. */
POINT
(
"Point"
),
/** Line constraint. */
LINE
(
"Line"
),
/** Plane constraint. */
PLANE
(
"Plane"
),
/** Cylinder constraint. */
CYLINDER
(
"Cylinder"
),
/** Circle constraint. */
CIRCLE
(
"Circle"
),
/** Special value for unsupported constraints. */
UNSUPPORTED
(
"Unsupported"
),
/** Special value for unknown constraints. */
UNKNOWN
(
"UNKNOWN"
);
/** String representation of the type. */
private
String
name
;
/**
* Constructor.
* @param name String representation of the type
*/
Type
(
String
name
)
{
this
.
name
=
name
;
}
/**
* Converts a string to a type.
* @param name String representation of the type
* @return The type if it exists, null otherwise
*/
public
static
Type
fromString
(
String
name
)
{
switch
(
name
)
{
case
"Point"
:
...
...
@@ -47,17 +69,32 @@ public class MateEntity {
}
}
/**
* String representation of the type.
* @return Name of the type
*/
@Override
public
String
toString
()
{
return
this
.
name
;
}
}
/** Type of the entity. */
private
Type
type
;
/** Component constrained by the entity. */
private
Component
target
;
/** Position of the constraint, in local system. */
private
Point3D
position
;
/** Axis (or direction) of the constraint, in local system. Should be a unit vector. */
private
Point3D
axis
;
/** Array of radius of the constraint. */
private
double
[]
radius
;
/** Number of radius per entity. */
public
static
final
int
NB_RADIUS
=
2
;
/**
...
...
@@ -74,51 +111,101 @@ public class MateEntity {
}
}
/**
* Gets the type.
* @return The type
*/
public
Type
getType
()
{
return
this
.
type
;
}
/**
* Gets the target.
* @return The target.
*/
public
Component
getTarget
()
{
return
this
.
target
;
}
/**
* Gets the position.
* @return The position.
*/
public
Point3D
getPosition
()
{
return
this
.
position
;
}
/**
* Gets the axis.
* @return The axis.
*/
public
Point3D
getAxis
()
{
return
this
.
axis
;
}
/**
* Gets the radius.
* @param i Radius index
* @return The radius.
*/
public
double
getRadius
(
int
i
)
{
return
this
.
radius
[
i
];
}
/**
* Sets the type.
* @param type The type
*/
public
void
setType
(
Type
type
)
{
this
.
type
=
type
;
}
/**
* Sets the target.
* @param target The target
*/
public
void
setTarget
(
Component
target
)
{
this
.
target
=
target
;
}
/**
* Sets the position.
* @param position The position
*/
public
void
setPosition
(
Point3D
position
)
{
this
.
position
=
position
;
}
/**
* Sets the axis.
* @param axis The axis
*/
public
void
setAxis
(
Point3D
axis
)
{
this
.
axis
=
axis
;
}
/**
* Sets the radius.
* @param i Radius index
* @param radius The radius
*/
public
void
setRadius
(
int
i
,
double
radius
)
{
this
.
radius
[
i
]
=
radius
;
}
/**
* Position of the constraint in global system.
* @return The global position
*/
public
Point3D
positionInScene
()
{
Transform
toScene
=
this
.
target
.
getSceneNode
().
getLocalToSceneTransform
();
return
toScene
.
transform
(
this
.
position
);
}
/**
* Axis (or direction) of the constraint in global system.
* @return The global axis
*/
public
Point3D
axisInScene
()
{
Transform
toScene
=
this
.
target
.
getSceneNode
().
getLocalToSceneTransform
();
Point3D
origin
=
toScene
.
transform
(
Point3D
.
ZERO
);
...
...
@@ -153,6 +240,10 @@ public class MateEntity {
return
code
;
}
/**
* Returns a string representation of the object.
* @return String representation of the object.
*/
@Override
public
String
toString
()
{
String
str
=
"MateEntity [\n "
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment