ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccGeoObject.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <ecvHObject.h>
11 #include <ecvMainAppInterface.h>
12 #include <ecvPointCloud.h>
13 
14 #include "ccFitPlane.h"
15 #include "ccPointPair.h"
16 #include "ccTrace.h"
17 
18 class ccTopologyRelation;
19 
20 /*
21 ccGeoObjects are a data-organisation structure comprised of four ccHObjects, a
22 parent (representing the "GeoObject") and 3 children, representing the "upper
23 boundary", "lower boundary" and "interior" of the GeoObject.
24 */
25 
26 class ccGeoObject : public ccHObject {
27 public:
28  ccGeoObject(QString name, ecvMainAppInterface* app, bool singleSurface);
30 
31  // returns the pointCloud associated with this ccGeoObject's interior (or
32  // null if the interior is undefined)
34 
35  // returns the ccHObject parent of the specified mapping region (see below
36  // for mapping region consts)
37  ccHObject* getRegion(int mappingRegion);
38 
39  // draws all children objects in "highlighted" mode
40  void setActive(bool active);
41 
42  // gets the topological relationship between this GeoObject and another
43  int getRelationTo(ccGeoObject* obj, ccTopologyRelation** out = nullptr);
44 
45  // adds a topological relationship between this GeoObject and another
47  int type,
48  ecvMainAppInterface* app);
49 
50  // returns the GID of this geo-object
51  unsigned int getGID() { return _gID; };
52 
53  // flags defining different mapping regions
54  static const int INTERIOR = 0;
55  static const int UPPER_BOUNDARY = 1;
56  static const int LOWER_BOUNDARY = 2;
57 
58 protected:
59  // link back to the main plugin interface
61 
62  // the dataset this object "belongs" too. Assigned when an "interior" gets
63  // defined.
65 
66  // group containing interior point set and associated measurments
67  ccHObject* m_interior = nullptr;
68  int m_interior_id = -1;
69 
70  // group containing upper boundary polylines and associated measurments
71  ccHObject* m_upper = nullptr;
72  int m_upper_id = -1;
73 
74  // group containing lower boundary polylines/traces and associated
75  // measurments
76  ccHObject* m_lower = nullptr;
77  int m_lower_id = -1;
78 
79  // protected functions for generating the above objects
80  void generateInterior();
81  void generateUpper();
82  void generateLower();
83 
84 private:
85  // builds this GeoObject and its ccHObject components
86  void init(bool singleSurface);
87 
88  // searches and activates/disactivates children belonging to the ccHObject.
89  // This is used when the DBTree selection changes.
90  void recurseChildren(ccHObject* par, bool highlight);
91 
92  // return the topology relationship between this ccHObject and another
93  // (WIP).
94  ccTopologyRelation* getRelation(ccHObject* obj, int id1, int id2);
95 
96  void assignGID();
97 
98  unsigned int _gID; // unique and persistent id for this geoObject
99  // static functions
100 public:
101  // returns true if object is a ccGeoObject
102  static bool isGeoObject(ccHObject* object);
103 
104  // returns true if object is the upper component of a ccGeoObject
105  static bool isGeoObjectUpper(ccHObject* object);
106 
107  // returns true if object is the lower component of a ccGeoObject
108  static bool isGeoObjectLower(ccHObject* object);
109 
110  // returns ture if object is the interior component of a ccGeoObject
111  static bool isGeoObjectInterior(ccHObject* object);
112 
113  // returns true if object is a single-surface GeoObject rather than a
114  // generic GeoObject
115  static bool isSingleSurfaceGeoObject(ccHObject* object);
116 
117  // traverses up the DbTree, starting at object, until a ccGeoObject is
118  // found. If none is found this will return null.
119  static ccGeoObject* getGeoObjectParent(ccHObject* object);
120 
121  // traverses up the DbTree, starting at object, until a ccGeoObject
122  // representing the interior, upper or lower surface. returns -1 if no
123  // ccGeoObject is found, otherwise ccGeoObject::INTERIOR,
124  // ccGeoObject::UPPER_BOUNDARY or ccGeoObject::LOWER_BOUNDARY
125  static int getGeoObjectRegion(ccHObject* object);
126 };
std::string name
char type
int getRelationTo(ccGeoObject *obj, ccTopologyRelation **out=nullptr)
void setActive(bool active)
static ccGeoObject * getGeoObjectParent(ccHObject *object)
int m_upper_id
Definition: ccGeoObject.h:72
static bool isGeoObjectInterior(ccHObject *object)
ccHObject * m_lower
Definition: ccGeoObject.h:76
static const int INTERIOR
Definition: ccGeoObject.h:54
static const int UPPER_BOUNDARY
Definition: ccGeoObject.h:55
ccHObject * m_upper
Definition: ccGeoObject.h:71
void generateInterior()
void generateLower()
ccPointCloud * m_associatedCloud
Definition: ccGeoObject.h:64
static int getGeoObjectRegion(ccHObject *object)
ccHObject * getRegion(int mappingRegion)
Definition: ccGeoObject.cpp:73
int m_lower_id
Definition: ccGeoObject.h:77
ccPointCloud * getAssociatedCloud()
Definition: ccGeoObject.cpp:71
ccHObject * m_interior
Definition: ccGeoObject.h:67
ccTopologyRelation * addRelationTo(ccGeoObject *obj2, int type, ecvMainAppInterface *app)
static bool isGeoObjectLower(ccHObject *object)
void generateUpper()
int m_interior_id
Definition: ccGeoObject.h:68
static bool isGeoObject(ccHObject *object)
static bool isSingleSurfaceGeoObject(ccHObject *object)
ccGeoObject(QString name, ecvMainAppInterface *app, bool singleSurface)
Definition: ccGeoObject.cpp:13
static const int LOWER_BOUNDARY
Definition: ccGeoObject.h:56
static bool isGeoObjectUpper(ccHObject *object)
ecvMainAppInterface * m_app
Definition: ccGeoObject.h:60
unsigned int getGID()
Definition: ccGeoObject.h:51
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Main application interface (for plugins)