GeometryModel.h
1 //##################################################################################################
2 //
3 // Ceetron Desktop Components
4 // Component: Geometry
5 //
6 // --------------------------------------------------------------------------------------------
7 // Copyright (C) 2013, Ceetron AS
8 // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Ceetron AS. The contents of this file may
9 // not be disclosed to third parties, copied or duplicated in any form, in whole or in part,
10 // without the prior written permission of Ceetron AS.
11 //##################################################################################################
12 
13 #pragma once
14 
15 #include "CeeGeometry/Base.h"
16 #include "CeeGeometry/PartHitItems.h"
17 #include "CeeVisualization/Model.h"
18 #include "CeeCore/BoundingBox.h"
19 #include "CeeCore/Ray.h"
20 #include "CeeVisualization/View.h"
21 #include "CeeCore/Str.h"
22 #include "CeeCore/Vec2f.h"
23 
24 namespace cee {
25 namespace geo {
26 
27 class Part;
28 class HitItem;
29 
30 
31 //==================================================================================================
32 //
33 //
34 //
35 //==================================================================================================
36 class CEE_GEO_EXPORT GeometryModel : public vis::Model
37 {
38 public:
39  GeometryModel();
40  virtual ~GeometryModel();
41 
42  virtual BoundingBox boundingBox();
43  virtual Str modelInfo() const;
44  virtual void update(bool forceRecreate);
45 
46  const Mat4d& transformation() const;
47  void setTransformation(const Mat4d& transformMatrix);
48 
49  size_t partCount() const;
50  size_t partIndex(Part* part) const;
51  Part* part(size_t index);
52  const Part* part(size_t index) const;
53  Part* partById(int id);
54  const Part* partById(int id) const;
55  void addPart(Part* part);
56  void removePart(Part* part);
57  void removeAllParts();
58  bool hasPart(Part* part) const;
59 
60  bool rayIntersect(int x, int y, const vis::View& view, HitItem* hitItem);
61  bool regionIntersect(int x, int y, unsigned int width, unsigned int height, const vis::View& view, bool acceptPartiallyContainedParts, std::vector<Part*>* partList);
62  bool regionIntersectPartItems(int x, int y, unsigned int width, unsigned int height, const vis::View& view, bool acceptPartiallyContainedItems, std::vector<PartHitItems>* hitItems);
63  bool polygonIntersect(const std::vector<Vec2f>& polygonInWindowCoordinates, const vis::View& view, bool acceptPartiallyContainedParts, std::vector<Part*>* partList);
64  bool rayIntersect(const Ray& ray, const vis::View& view, HitItem* hitItem);
65 
66  size_t renderedPartCount() const;
67 
68 public:
69  bool internal_exportGeometry(const Str& fileName);
70 
71 private:
72  virtual cvf::Model* internal_cvfModel();
73  virtual void internal_setViewCapabilities(const cvf::OpenGLCapabilities& capabilities, bool viewDoesHighlighting);
74  virtual bool internal_canAddToViewWithCapabilities(const cvf::OpenGLCapabilities& viewCapabilities) const;
75  virtual NotifyAction internal_detectAndConfigureViewClippingInModel(const vis::View& triggeringView, cvf::OpenGLContext* cvfContext);
76  virtual void internal_applyViewClippingPlanesBeforeRendering(const cvf::ClipPlaneSet* viewClipPlaneSet, const cvf::Plane* dropShadowClipPlane);
77  virtual void internal_applyCameraTransformationToClippingPlanes(const cvf::Camera& camera);
78  virtual NotifyAction internal_preRenderUpdateModel(const vis::View& triggeringView, cvf::OpenGLContext* cvfContext);
79 
80 private:
81  CEE_PRIVATE_IMPL(GeometryModel);
82  CEE_DISALLOW_COPY_AND_ASSIGN(GeometryModel);
83 };
84 
85 } // namespace geo
86 } // namespace cee
Namespace cee contains all functionality and structures under the Core component. ...
Definition: AppComponent.cpp:26
Small class containing the result of an intersection between a ray and a part in a GeometryModel...
Definition: HitItem.h:29
A general unicode based string class.
Definition: Str.h:28
A ray that can be used for intersection testing.
Definition: Ray.h:27
Model holds information which is to be gathered to constitute a view.
Definition: Model.h:43
Axis-aligned bounding box.
Definition: BoundingBox.h:27
GeometryModel is a subclass of Model that can handle a large number of parts efficiently.
Definition: GeometryModel.h:36
Provides a render area in the user control/widget to enable visualization of the current model data a...
Definition: View.h:40
NotifyAction
Notification sent to the view.
Definition: Model.h:59
Geometry part and how it is to be drawn.
Definition: Part.h:32
4 dimensional matrix.
Definition: Mat4d.h:26