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 };
ccGeoObject::isGeoObjectInterior
static bool isGeoObjectInterior(ccHObject *object)
Definition: ccGeoObject.cpp:364
ccGeoObject::m_upper
ccHObject * m_upper
Definition: ccGeoObject.h:71
ccGeoObject::m_associatedCloud
ccPointCloud * m_associatedCloud
Definition: ccGeoObject.h:64
ccGeoObject::getGID
unsigned int getGID()
Definition: ccGeoObject.h:51
ccGeoObject::isGeoObject
static bool isGeoObject(ccHObject *object)
Definition: ccGeoObject.cpp:337
ccPointCloud
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ecvPointCloud.h:146
ccPointPair.h
ecvMainAppInterface.h
ccGeoObject::m_app
ecvMainAppInterface * m_app
Definition: ccGeoObject.h:60
ccGeoObject::ccGeoObject
ccGeoObject(QString name, ecvMainAppInterface *app, bool singleSurface)
Definition: ccGeoObject.cpp:13
ccGeoObject::getRelationTo
int getRelationTo(ccGeoObject *obj, ccTopologyRelation **out=nullptr)
Definition: ccGeoObject.cpp:109
ccGeoObject::m_lower_id
int m_lower_id
Definition: ccGeoObject.h:77
ccGeoObject::generateInterior
void generateInterior()
Definition: ccGeoObject.cpp:272
ecvMainAppInterface
Main application interface (for plugins)
Definition: ecvMainAppInterface.h:24
ccTrace.h
ccGeoObject::INTERIOR
static const int INTERIOR
Definition: ccGeoObject.h:54
ccTopologyRelation
Definition: ccTopologyRelation.h:20
ccGeoObject::m_lower
ccHObject * m_lower
Definition: ccGeoObject.h:76
ccGeoObject::getAssociatedCloud
ccPointCloud * getAssociatedCloud()
Definition: ccGeoObject.cpp:71
ccGeoObject
Definition: ccGeoObject.h:26
ccGeoObject::getRegion
ccHObject * getRegion(int mappingRegion)
Definition: ccGeoObject.cpp:73
ccGeoObject::getGeoObjectRegion
static int getGeoObjectRegion(ccHObject *object)
Definition: ccGeoObject.cpp:395
ccGeoObject::getGeoObjectParent
static ccGeoObject * getGeoObjectParent(ccHObject *object)
Definition: ccGeoObject.cpp:382
ccGeoObject::m_interior_id
int m_interior_id
Definition: ccGeoObject.h:68
ccGeoObject::setActive
void setActive(bool active)
Definition: ccGeoObject.cpp:210
ccGeoObject::generateLower
void generateLower()
Definition: ccGeoObject.cpp:316
ccGeoObject::m_upper_id
int m_upper_id
Definition: ccGeoObject.h:72
ccGeoObject::isGeoObjectUpper
static bool isGeoObjectUpper(ccHObject *object)
Definition: ccGeoObject.cpp:346
ccGeoObject::isGeoObjectLower
static bool isGeoObjectLower(ccHObject *object)
Definition: ccGeoObject.cpp:355
ccGeoObject::addRelationTo
ccTopologyRelation * addRelationTo(ccGeoObject *obj2, int type, ecvMainAppInterface *app)
Definition: ccGeoObject.cpp:162
ccGeoObject::generateUpper
void generateUpper()
Definition: ccGeoObject.cpp:295
ccGeoObject::isSingleSurfaceGeoObject
static bool isSingleSurfaceGeoObject(ccHObject *object)
Definition: ccGeoObject.cpp:373
ccFitPlane.h
ccHObject
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
ecvHObject.h
type
char type
Definition: FileIOFactory.cpp:131
ecvPointCloud.h
ccGeoObject::UPPER_BOUNDARY
static const int UPPER_BOUNDARY
Definition: ccGeoObject.h:55
ccGeoObject::LOWER_BOUNDARY
static const int LOWER_BOUNDARY
Definition: ccGeoObject.h:56
name
std::string name
Definition: FileIOFactory.cpp:129
ccGeoObject::m_interior
ccHObject * m_interior
Definition: ccGeoObject.h:67