Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HUtilityPMI.h
00001 /*
00002 * Copyright (c) 2004 by Tech Soft 3D, LLC.
00003 * The information contained herein is confidential and proprietary to
00004 * Tech Soft 3D, LLC., and considered a trade secret as defined under
00005 * civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00006 * and criminal remedies in the event of unauthorized use or misappropriation
00007 * of its trade secrets.  Use of this information by anyone other than
00008 * authorized employees of Tech Soft 3D, LLC. is granted only under a
00009 * written non-disclosure agreement, expressly prescribing the scope and
00010 * manner of such use.
00011 *
00012 * $Id$
00013 */
00014 
00015 #ifndef _HUTILITYPMI_H
00016 #define _HUTILITYPMI_H
00017 
00018 #include "hc.h"
00019 
00020 #include "HTools.h"
00021 #include "HGlobals.h"
00022 #include "HUtility.h"
00023 
00024 #ifdef H_PACK_8
00025 #pragma pack(push)
00026 #pragma pack(8)
00027 #endif
00028 
00029 namespace PMII
00030 {
00031     class PrivateImpl;
00032 };
00033 
00037 namespace PMI 
00038 {
00039 
00040 // ======================= start enums =======================
00041 
00045 enum Type
00046 {
00047     UnknownType,
00048     DatumType,
00049     DimensionType,
00050     FeatureControlFrameType,
00051     GenericType,
00052     NoteType,
00053     RoughnessType
00054 };
00055 
00059 namespace Datum
00060 {
00064     enum Type
00065     {
00066         Unknown,
00067         Identifier,
00068         Target
00069     };
00070 };
00071 
00075 namespace Tolerance
00076 {
00080     enum Type
00081     {
00082         Unknown,
00083         Angularity,
00084         Circularity,
00085         CircularRunout,
00086         Concentricity,
00087         Cylindricity,
00088         Flatness,
00089         LineProfile,
00090         Parallelism,
00091         Perpendicularity,
00092         Position,
00093         Straightness,
00094         SurfaceProfile,
00095         Symmetry,
00096         TotalRunout
00097     };
00098 };
00099 
00103 namespace ZoneModifier
00104 {
00108     enum Type
00109     {
00110         None,
00111         MaximumMaterialCondition,
00112         LeastMaterialCondition,
00113         RegardlessOfFeatureSize,
00114         TangentPlane,
00115         ProjectedToleranceZone,
00116         FreeState,
00117         StatisticalTolerance
00118     };
00119 };
00120 
00124 namespace DatumModifier
00125 {
00129     enum Type
00130     {
00131         None,
00132         MaximumMaterialCondition,
00133         LeastMaterialCondition,
00134         RegardlessOfFeatureSize
00135     };
00136 };
00137 
00141 namespace DiameterModifier
00142 {
00146     enum Type
00147     {
00148         None,
00149         Diameter,
00150         SphericalDiameter
00151     };
00152 };
00153 
00157 namespace Dimension
00158 {
00162     enum Type
00163     {
00164         UnknownType,
00165         BasicType,
00166         ReferenceType,
00167         ToleranceType
00168     };
00169 
00173     enum SubType
00174     {
00175         UnknownSubType,
00176         AngleSubType,
00177         ChamferSubType,
00178         DiameterSubType,
00179         DistanceSubType,
00180         LengthSubType,
00181         RadiusSubType,
00182         SlopeSubType
00183     };
00184 };
00185 
00189 namespace Roughness
00190 {
00194     namespace Obtention
00195     {
00199         enum Type
00200         {
00201             Unknown,
00202             NotDefined,
00203             MachiningMandatory,
00204             MachiningForbidden
00205         };
00206     };
00207 
00211     namespace Applicability
00212     {
00216         enum Type
00217         {
00218             Unknown,
00219             SpecifiedSurface,
00220             SurroundingSurfaces,
00221             BasicSurface,
00222             AllSurfaces
00223         };
00224     };
00225 
00229     namespace Mode
00230     {
00234         enum Type
00235         {
00236             Unknown,
00237             None,
00238             MultiDirectional,
00239             Circular,
00240             Radial,
00241             Particular,
00242             WithAngles,
00243             Parallel,
00244             Perpendicular
00245         };
00246     };
00247 };
00248 
00249 // ======================= end enums =======================
00250 
00251 
00252 // ======================= start common classes =======================
00253 
00254 class Frame;
00255 class LeaderLine;
00256 class Orientation;
00257 class Polyline;
00258 class TextAttributes;
00259 class Polygon;
00260 
00261 typedef HPoint Point;
00262 typedef HPoint RGBColor;
00263 typedef HCamera Camera;
00264 
00265 
00269 class MVO_API Frame
00270 {
00271 public:
00272     Frame();
00273     Frame(Frame const & that);
00274     ~Frame();
00275 
00276     void Set(Frame const & that);
00277     Frame const & operator=(Frame const & that);
00278 
00280     unsigned int GetPolylineCount() const;
00287     void GetPolylines(unsigned int & out_count, Polyline out_polylines[]) const;
00292     void SetPolylines(unsigned int in_count, Polyline const in_polylines[]);
00293 
00294 private:
00295     PMII::PrivateImpl * impl_;
00296 };
00297 
00301 class MVO_API Drawing
00302 {
00303 public:
00304     Drawing();
00305     Drawing(Drawing const & that);
00306     ~Drawing();
00307 
00308     void Set(Drawing const & that);
00309     Drawing const & operator=(Drawing const & that);
00310 
00312     unsigned int GetPolygonCount() const;
00319     void GetPolygons(unsigned int & out_count, Polygon out_polygons[]) const;
00324     void SetPolygons(unsigned int in_count, Polygon const in_polygons[]);
00325 
00326 private:
00327     PMII::PrivateImpl * impl_;
00328 };
00329 
00330 
00338 class MVO_API Orientation
00339 {
00340 public:
00341     Orientation();
00342     Orientation(Orientation const & that);
00343     ~Orientation();
00344 
00345     void Set(Orientation const & that);
00346     Orientation const & operator=(Orientation const & that);
00347 
00349     void GetXComponent(Point & out_component) const;
00351     void GetXComponent(float & out_x, float & out_y, float & out_z) const;
00353     void SetXComponent(Point const & in_component);
00355     void SetXComponent(float in_x, float in_y, float in_z);
00356 
00358     void GetYComponent(Point & out_component) const;
00360     void GetYComponent(float & out_x, float & out_y, float & out_z) const;
00362     void SetYComponent(Point const & in_component);
00364     void SetYComponent(float in_x, float in_y, float in_z);
00365 
00367     void GetZComponent(Point & out_component) const;
00369     void GetZComponent(float & out_x, float & out_y, float & out_z) const;
00371     void SetZComponent(Point const & in_component);
00373     void SetZComponent(float in_x, float in_y, float in_z);
00374 
00376     void GetOriginComponent(Point & out_component) const;
00378     void GetOriginComponent(float & out_x, float & out_y, float & out_z) const;
00380     void SetOriginComponent(Point const & in_component);
00382     void SetOriginComponent(float in_x, float in_y, float in_z);
00383 
00385     void GetMatrix(float out_matrix[16]) const;
00387     void SetMatrix(float const in_matrix[16]);
00388 
00389 private:
00390     PMII::PrivateImpl * impl_;
00391 };
00392 
00393 
00397 class MVO_API Polyline
00398 {
00399 public:
00400     Polyline();
00401     Polyline(Polyline const & that);
00402     ~Polyline();
00403 
00404     void Set(Polyline const & that);
00405     Polyline const & operator=(Polyline const & that);
00406 
00408     void GetRGBColor(RGBColor & out_color) const;
00410     void GetRGBColor(float & out_r, float & out_g, float & out_b) const;
00412     void SetRGBColor(RGBColor const & in_color);
00414     void SetRGBColor(float const in_r, float const in_g, float const in_b);
00415 
00417     void GetLinePattern(char out_pattern[1024]) const;
00419     void SetLinePattern(char const in_pattern[1024]);
00420 
00422     unsigned int GetPointCount() const;
00429     void GetPoints(unsigned int & out_count, Point out_points[]) const;
00436     void GetPoints(unsigned int & out_count, float out_points[]) const;
00441     void SetPoints(unsigned int in_count, Point const in_points[]);
00446     void SetPoints(unsigned int in_count, float const in_points[]);
00447 
00448 private:
00449     PMII::PrivateImpl * impl_;
00450 };
00451 
00455 class MVO_API Polygon
00456 {
00457 public:
00458     Polygon();
00459     Polygon(Polygon const & that);
00460     ~Polygon();
00461 
00462     void Set(Polygon const & that);
00463     Polygon const & operator=(Polygon const & that);
00464 
00466     void GetRGBColor(RGBColor & out_color) const;
00468     void GetRGBColor(float & out_r, float & out_g, float & out_b) const;
00470     void SetRGBColor(RGBColor const & in_color);
00472     void SetRGBColor(float const in_r, float const in_g, float const in_b);
00473 
00475     unsigned int GetPointCount() const;
00482     void GetPoints(unsigned int & out_count, Point out_points[]) const;
00489     void GetPoints(unsigned int & out_count, float out_points[]) const;
00494     void SetPoints(unsigned int in_count, Point const in_points[]);
00499     void SetPoints(unsigned int in_count, float const in_points[]);
00500 
00501 private:
00502     PMII::PrivateImpl * impl_;
00503 };
00504 
00508 class MVO_API TextAttributes
00509 {
00510 public:
00511     TextAttributes();
00512     TextAttributes(TextAttributes const & that);
00513     ~TextAttributes();
00514 
00515     void Set(TextAttributes const & that);
00516     TextAttributes const & operator=(TextAttributes const & that);
00517 
00519     void GetInsertionPoint(Point & out_point) const;
00521     void GetInsertionPoint(float & out_x, float & out_y, float & out_z) const;
00523     void SetInsertionPoint(Point const & in_point);
00525     void SetInsertionPoint(float in_x, float in_y, float in_z);
00526 
00528     void GetFontSize(float & out_size) const;
00530     void SetFontSize(float const in_size);
00531 
00533     void GetFontName(char * out_font_name) const;
00535     void SetFontName(char const * in_font_name);
00536 
00538     void GetOrientation(Orientation & out_orientation) const;
00540     void SetOrientation(Orientation const & in_orientation);
00541 
00543     void GetRGBColor(RGBColor & out_color) const;
00545     void GetRGBColor(float & out_r, float & out_g, float & out_b) const;
00547     void SetRGBColor(RGBColor const & in_color);
00549     void SetRGBColor(float in_r, float in_g, float in_b);
00550 
00551     
00553     bool IsBold() const;
00555     bool IsItalic() const;
00557     bool IsUnderlined() const;
00559     bool IsStrikedThrough() const;
00561     bool IsOverlined() const;
00563     bool IsStreched() const;
00565     bool IsWired() const;
00567     bool IsFixedWidth() const;
00569     void SetFormat(char const & in_format);
00570     
00572     double WidthScale() const;
00574     void SetWidthScale(const double width_scale);
00575 
00576 private:
00577     PMII::PrivateImpl * impl_;
00578 };
00579 
00580 
00586 class MVO_API String
00587 {
00588 public:
00589     String();
00590     String(char const * cstring);
00591     String(wchar_t const * wstring);
00592     String(H_WCS const & wcs);
00593     String(H_UTF8 const & utf8);
00594     String(String const & that);
00595     ~String();
00596 
00597     void Set(String const & in_that);
00598     String const & operator=(String const & in_that);
00599 
00601     char const * CStr() const;
00603     wchar_t const * WStr() const;
00605     size_t  WLength() const;
00606 
00607     bool Equals(String const & in_that) const;
00608     bool operator==(String const & in_that) const;
00609     bool operator!=(String const & in_that) const;
00610 
00611 private:
00612     PMII::PrivateImpl * impl_;
00613 };
00614 
00618 class MVO_API Options
00619 {
00620 public:
00621     Options();
00622     Options(Options const & that);
00623     ~Options();
00624 
00625     void Set(Options const & that);
00626     Options const & operator=(Options const & that);
00627 
00629     void SetDisplayParallelToScreen(bool const in_parallel  = true);
00631     bool IsDisplayParallelToScreen() const;
00632 
00633 private:
00634     PMII::PrivateImpl * impl_;
00635 };
00636 // ======================= end common classes =======================
00637 
00638 
00639 // ====================== start actual entities =======================
00640 
00641 class Entity;
00642 class DatumEntity;
00643 class DimensionEntity;
00644 class FeatureControlFrameEntity;
00645 class GenericEntity;
00646 class GeometricToleranceEntity;
00647 class NoteEntity;
00648 class RoughnessEntity;
00649 class ViewEntity;
00650 
00651 
00656 class MVO_API Entity
00657 {
00658 public:
00661     Entity(HC_KEY segment_key = INVALID_KEY);
00662     Entity(Entity const & that);
00663     virtual ~Entity(); 
00664 
00665     void Set(Entity const & that);
00666     Entity const & operator=(Entity const & that);
00667 
00669     virtual Type GetType() const { return PMI::UnknownType; };
00670 
00672     HC_KEY GetSegmentKey() const;
00673 
00675     void GetFrame(Frame & out_frame) const;
00677     void SetFrame(Frame const & in_frame);
00678 
00680     unsigned int GetLeaderLineCount() const;
00687     void GetLeaderLines(unsigned int & out_count, Polyline out_leader_lines[]) const;
00692     void SetLeaderLines(unsigned int in_count, Polyline const in_leader_lines[]);
00693 
00695     unsigned int GetLeaderSymbolCount() const;
00702     void GetLeaderSymbols(unsigned int & out_count, Polygon out_leader_symbols[]) const;
00707     void SetLeaderSymbols(unsigned int in_count, Polygon const * in_leader_symbols);
00708 
00709 
00711     void SetDisplayParallelToScreen(bool const in_parallel = true);
00713     bool IsDisplayParallelToScreen() const;
00714 
00715 
00717     void GetDrawing(Drawing & out_drawing) const;
00719     void SetDrawing(Drawing const & in_drawing);
00720 
00721 
00722 protected:
00723     PMII::PrivateImpl * impl_;
00724 };
00725 
00726 
00730 class MVO_API DatumEntity : public Entity
00731 {
00732 public:
00735     DatumEntity(HC_KEY segment_key = INVALID_KEY);
00736     DatumEntity(DatumEntity const & that);
00737     virtual ~DatumEntity(); 
00738 
00739     void Set(DatumEntity const & that);
00740     DatumEntity const & operator=(DatumEntity const & that);
00741 
00742     virtual Type GetType() const { return PMI::DatumType; };
00743     
00745     Datum::Type GetDatumType() const;
00747     void SetDatumType(Datum::Type const in_type);
00748 
00749     /* \return the number of labels for this DatumEntity */
00750     unsigned int GetLabelCount() const;
00760     void GetLabels(unsigned int & out_count, String out_labels[], TextAttributes out_text_attributes[]) const;
00766     void SetLabels(unsigned int in_count, String const in_labels[], TextAttributes const in_text_attributes[]);
00767 };
00768 
00769 
00773 class MVO_API DimensionEntity : public Entity
00774 {
00775 public:
00778     DimensionEntity(HC_KEY segment_key = INVALID_KEY);
00779     DimensionEntity(DimensionEntity const & that);
00780     virtual ~DimensionEntity(); 
00781 
00782     void Set(DimensionEntity const & that);
00783     DimensionEntity const & operator=(DimensionEntity const & that);
00784     
00785     virtual Type GetType() const { return PMI::DimensionType; };
00786 
00788     Dimension::Type GetDimensionType() const;
00790     void SetDimensionType(Dimension::Type const in_type);
00791 
00793     Dimension::SubType GetDimensionSubType() const;
00795     void SetDimensionSubType(Dimension::SubType const in_sub_type);
00796 
00798     unsigned int GetStringCount() const;
00808     void GetStrings(unsigned int & out_count, String out_strings[], TextAttributes out_text_attributes[]) const;
00814     void SetStrings(unsigned int in_count, String const in_strings[], TextAttributes const in_text_attributes[]);
00815 };
00816 
00817 
00821 class MVO_API FeatureControlFrameEntity : public Entity
00822 {
00823 public:
00826     FeatureControlFrameEntity(HC_KEY segment_key = INVALID_KEY);
00827     FeatureControlFrameEntity(FeatureControlFrameEntity const & that);
00828     virtual ~FeatureControlFrameEntity();
00829 
00830     void Set(FeatureControlFrameEntity const & that);
00831     FeatureControlFrameEntity const & operator=(FeatureControlFrameEntity const & that);
00832 
00833     virtual Type GetType() const { return PMI::FeatureControlFrameType; };
00834 
00840     void GetToleranceType(Tolerance::Type & out_tolerance_type, TextAttributes & out_text_attributes) const;
00845     void SetToleranceType(Tolerance::Type const in_tolerance_type, TextAttributes const & in_text_attributes);
00846 
00852     void GetDiameterModifierType(DiameterModifier::Type & out_diameter_modifier_type, TextAttributes & out_text_attributes) const;
00857     void SetDiameterModifierType(DiameterModifier::Type const in_diameter_modifier_type, TextAttributes const & in_text_attributes);
00858 
00864     void GetZoneToleranceMagnitude(String & out_zone_tolerance_magnitude, TextAttributes & out_text_attributes) const;
00870     void SetZoneToleranceMagnitude(String const & in_zone_tolerance_magnitude, TextAttributes const & in_text_attributes);
00871 
00877     void GetFirstZoneModifierType(ZoneModifier::Type & out_zone_modifier_type, TextAttributes & out_text_attributes) const;
00883     void SetFirstZoneModifierType(ZoneModifier::Type const in_zone_modifier_type, TextAttributes const & in_text_attributes);
00884 
00890     void GetSecondZoneModifierType(ZoneModifier::Type & out_zone_modifier_type, TextAttributes & out_text_attributes) const;
00896     void SetSecondZoneModifierType(ZoneModifier::Type const in_zone_modifier_type, TextAttributes const & in_text_attributes);
00897 
00903     void GetProjectedMagnitude(String & out_projected_magnitude, TextAttributes & out_text_attributes) const;
00909     void SetProjectedMagnitude(String const & in_projected_magnitude, TextAttributes const & in_text_attributes);
00910 
00912     unsigned int GetDatumReferenceCount() const;
00926     void GetDatumReferences(unsigned int & out_count, String out_labels[], TextAttributes out_label_attributes[],
00927                             DatumModifier::Type out_modifiers[], TextAttributes out_modifier_attributes[]);
00935     void SetDatumReferences(unsigned int in_count, String const in_labels[], TextAttributes const in_label_attributes[],
00936                             DatumModifier::Type const in_modifiers[], TextAttributes const in_modifier_attributes[]);
00937 };
00938 
00939 
00943 class MVO_API GenericEntity : public Entity
00944 {
00945 public:
00948     GenericEntity(HC_KEY segment_key = INVALID_KEY);
00949     GenericEntity(GenericEntity const & that);
00950     virtual ~GenericEntity();
00951 
00952     void Set(GenericEntity const & that);
00953     GenericEntity const & operator=(GenericEntity const & that);
00954 
00955     virtual Type GetType() const { return PMI::GenericType; };
00956 
00958     unsigned int GetStringCount() const;
00968     void GetStrings(unsigned int & out_count, String out_strings[], TextAttributes out_text_attributes[]) const;
00974     void SetStrings(unsigned int in_count, String const in_strings[], TextAttributes const in_text_attributes[]);
00975 
00976 
00980     void SetDisplayParallelToScreen(bool const in_parallel = true);
00984     bool IsDisplayParallelToScreen() const;
00985 
00986 };
00987 
00988 
00992 class MVO_API NoteEntity : public Entity
00993 {
00994 public:
00997     NoteEntity(HC_KEY segment_key = INVALID_KEY);
00998     NoteEntity(NoteEntity const & that);
00999     virtual ~NoteEntity();
01000 
01001     void Set(NoteEntity const & that);
01002     NoteEntity const & operator=(NoteEntity const & that);
01003 
01004     virtual Type GetType() const { return PMI::NoteType; };
01005 
01007     unsigned int GetStringCount() const;
01017     void GetStrings(unsigned int & out_count, String out_strings[], TextAttributes out_text_attributes[]) const;
01023     void SetStrings(unsigned int in_count, String const in_strings[], TextAttributes const in_text_attributes[]);
01024 };
01025 
01026 
01030 class MVO_API RoughnessEntity : public Entity
01031 {
01032 public:
01035     RoughnessEntity(HC_KEY segment_key = INVALID_KEY);
01036     RoughnessEntity(RoughnessEntity const & that);
01037     virtual ~RoughnessEntity();
01038 
01039     void Set(RoughnessEntity const & that);
01040     RoughnessEntity const & operator=(RoughnessEntity const & that);
01041     
01042     virtual Type GetType() const { return PMI::RoughnessType; };
01043 
01045     Roughness::Obtention::Type GetObtentionType() const;
01047     void SetObtentionType(Roughness::Obtention::Type const in_obtention_type);
01048 
01050     Roughness::Applicability::Type GetApplicabilityType() const;
01052     void SetApplicabilityType(Roughness::Applicability::Type const in_applicability_type);
01053 
01055     Roughness::Mode::Type GetModeType() const;
01057     void SetModeType(Roughness::Mode::Type const in_mode_type);
01058 
01060     unsigned int GetFieldCount() const;
01070     void GetFields(unsigned int & out_count, String out_fields[], TextAttributes out_text_attributes[]) const;
01076     void SetFields(unsigned int in_count, String const in_fields[], TextAttributes const in_text_attributes[]);
01077 };
01078 
01079 
01083 class MVO_API ViewEntity
01084 {
01085 public:
01088     ViewEntity(HC_KEY segment_key = INVALID_KEY);
01089     ViewEntity(ViewEntity const & that);
01090     virtual ~ViewEntity();
01091 
01092     void Set(ViewEntity const & that);
01093     ViewEntity const & operator=(ViewEntity const & that);
01094 
01096     void GetCamera(Camera & out_camera) const;
01098     void GetCamera(Point & out_position, Point & out_target, Point & out_up_vector, float & out_field_width, float & out_field_height,
01099             char out_projection[128]);
01101     void GetCamera(float out_position[3], float out_target[3], float out_up_vector[3], float & out_field_width, float & out_field_height,
01102             char out_projection[128]);
01104     void SetCamera(Camera const & in_camera);
01106     void SetCamera(Point const & in_position, Point const & in_target, Point const & in_up_vector, float in_field_width,
01107             float in_field_height, char const in_projection[128]);
01109     void SetCamera(float const in_position[3], float const in_target[3], float const in_up_vector[3], float in_field_width,
01110             float in_field_height, char const in_projection[128]);
01111 
01113     void GetFrame(Frame & out_frame) const;
01115     void SetFrame(Frame const & in_frame);
01116 
01118     void GetName(String & out_name) const;
01120     void SetName(String const & in_name);
01121 
01123     unsigned int GetAssociatedEntityCount() const;
01130     void GetAssociatedEntities(unsigned int & out_count, Entity out_entities[]) const;
01135     void SetAssociatedEntities(unsigned int in_count, Entity const in_entities[]);
01136 
01137 protected:
01138     PMII::PrivateImpl * impl_;
01139 };
01140 
01141 // ====================== end actual entities =======================
01142 
01143 
01144 }; // PMI
01145 
01146 #ifdef H_PACK_8
01147 #pragma pack(pop)
01148 #endif
01149 
01150 #endif // _HUTILITYPMI_H