Topologic  0.8.9
Topology.h
1 // This file is part of Topologic software library.
2 // Copyright(C) 2019, Cardiff University and University College London
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
13 //
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 
17 #pragma once
18 
19 #include "TopologicalQuery.h"
20 
21 #include <TopologicCore/include/Topology.h>
22 
23 #pragma make_public(TopologicCore::Topology)
24 #pragma make_public(TopologicCore::TopologyPtr)
25 
26 using namespace System;
27 using namespace System::Collections::Generic;
28 
29 #ifdef TOPOLOGIC_DYNAMO
30 using namespace Autodesk::DesignScript::Runtime;
31 #endif
32 
33 namespace Topologic
34 {
35  ref class Aperture;
36  ref class CellComplex;
37  ref class Cell;
38  ref class Shell;
39  ref class Face;
40  ref class Wire;
41  ref class Edge;
42  ref class Vertex;
43  ref class Context;
44 
45  namespace Factories
46  {
47  ref class TopologyFactory;
48  }
49 
53  public ref class Topology abstract : public TopologicalQuery
54  {
55  public:
56 #ifdef TOPOLOGIC_DYNAMO
57  static Topology^ ByGeometry(Autodesk::DesignScript::Geometry::Geometry^ geometry, [DefaultArgument("0.0001")] double tolerance);
64 
70  [IsVisibleInDynamoLibrary(false)]
71  static Topology^ ByPolySurface(Autodesk::DesignScript::Geometry::PolySurface^ polySurface);
72 
78  [IsVisibleInDynamoLibrary(false)]
79  static Topology^ ByFaces(System::Collections::Generic::IEnumerable<Face^>^ faces);
80 #endif
81 
88  static List<Topology^>^ ByVerticesIndices(System::Collections::Generic::IEnumerable<Vertex^>^ vertices, System::Collections::Generic::IEnumerable<System::Collections::Generic::List<int>^>^ vertexIndices);
89 
94  property int Dimensionality
95  {
96  int get();
97  }
98 
103 #ifdef TOPOLOGIC_DYNAMO
104  [IsVisibleInDynamoLibrary(false)]
105 #endif
106  property Object^ BasicGeometry
107  {
108  virtual Object^ get() abstract;
109  }
110 
115  property Object^ Geometry
116  {
117  virtual Object^ get();
118  }
119 
125 #ifdef TOPOLOGIC_DYNAMO
126  [IsVisibleInDynamoLibrary(false)]
127 #endif
128  Topology^ AddAttributesNoCopy(Dictionary<String^, Object^>^ attributes);
129 
134  property List<Topology^>^ Contents
135  {
136  List<Topology^>^ get();
137  }
138 
143  property List<Aperture^>^ Apertures
144  {
145  List<Aperture^>^ get();
146  }
147 
152 #ifdef TOPOLOGIC_DYNAMO
153  [IsVisibleInDynamoLibrary(false)]
154 #endif
155  property List<Topology^>^ SubContents
156  {
157  List<Topology^>^ get();
158  }
159 
164  property List<Context^>^ Contexts
165  {
166  List<Context^>^ get();
167  }
168 
169  /*/// <summary>
174  Topology^ AddContent(Topology^ topology);*/
175 
182 #ifdef TOPOLOGIC_DYNAMO
183  Topology^ AddContents(List<Topology^>^ contentTopologies, [DefaultArgument("0")] int typeFilter);
184 #else
185  Topology^ AddContents(List<Topology^>^ contentTopologies, int typeFilter);
186 #endif
187 
193 #ifdef TOPOLOGIC_DYNAMO
194  [IsVisibleInDynamoLibrary(false)]
195 #endif
196  Topology^ RemoveContent(Topology^ contentTopology);
197 
203  Topology^ RemoveContents(List<Topology^>^ contentTopologies);
204 
205  /*/// <summary>
210  Topology^ RemoveContexts(List<Context^>^ contexts);*/
211 
217  Topology^ AddApertures(System::Collections::Generic::IEnumerable<Topology^>^ apertureTopologies);
218 
219  /*/// <summary>
224  Topology^ AddContexts(List<Context^>^ contexts);*/
225 
226  /*/// <summary>
231 #ifdef TOPOLOGIC_DYNAMO
232  [IsVisibleInDynamoLibrary(false)]
233 #endif
234  Topology^ RemoveContext(Context^ context);*/
235 
242  List<Topology^>^ SharedTopologies(
243  Topology^ topology,
244 #ifdef TOPOLOGIC_DYNAMO
245  [Autodesk::DesignScript::Runtime::DefaultArgument("255")]
246 #endif
247  int typeFilter);
248 
254  Topology^ Difference(Topology^ topology);
255 
261  Topology^ Impose(Topologic::Topology^ tool);
262 
268  Topology^ Imprint(Topology^ tool);
269 
275  Topology^ Intersect(Topology^ topology);
276 
282  Topology^ Merge(Topology^ topology);
283 
288  Topology^ SelfMerge();
289 
295  Topology^ Slice(Topology^ tool);
296 
302  Topology^ Divide(Topology^ tool);
303 
309  Topology^ Union(Topology^ topology);
310 
316  Topology^ XOR(Topology^ topology);
317 
323  property Vertex^ CenterOfMass
324  {
325  Vertex^ get();
326  }
327 
333  property Vertex^ Centroid
334  {
335  Vertex^ get();
336  }
337 
343  bool ExportToBRep(String^ path);
344 
350  static Topology^ ByImportedBRep(String^ path);
351 
356  String^ Analyze();
357 
358 #ifdef TOPOLOGIC_DYNAMO
359  [IsVisibleInDynamoLibrary(false)]
360 #endif
361  property bool IsReversed
362  {
363  bool get();
364  }
365 
370 #ifdef TOPOLOGIC_DYNAMO
371  [IsVisibleInDynamoLibrary(false)]
372 #endif
373  property List<Topology^>^ SubTopologies
374  {
375  List<Topology^>^ get();
376  }
377 
382  property List<Shell^>^ Shells
383  {
384  List<Shell^>^ get();
385  }
386 
391  property List<Face^>^ Faces
392  {
393  List<Face^>^ get();
394  }
395 
400  property List<Wire^>^ Wires
401  {
402  List<Wire^>^ get();
403  }
404 
409  property List<Edge^>^ Edges
410  {
411  List<Edge^>^ get();
412  }
413 
418  property List<Vertex^>^ Vertices
419  {
420  List<Vertex^>^ get();
421  }
422 
427  property List<Cell^>^ Cells
428  {
429  List<Cell^>^ get();
430  }
431 
436  property List<CellComplex^>^ CellComplexes
437  {
438  List<CellComplex^>^ get();
439  }
440 
446  bool IsSame(Topology^ topology);
447 
453  Topology^ ClosestSimplestSubshape(Topology^ selector);
454 
461 #ifdef TOPOLOGIC_DYNAMO
462  [IsVisibleInDynamoLibrary(false)]
463  Topology^ SelectSubtopology(Vertex^ selector,
464  [Autodesk::DesignScript::Runtime::DefaultArgument("255")] int typeFilter);
465 #else
466  Topology^ SelectSubtopology(Vertex^ selector, int typeFilter);
467 #endif
468 
473  generic <class T>
474  where T: Topology
475 #ifdef TOPOLOGIC_DYNAMO
476  [IsVisibleInDynamoLibrary(false)]
477 #endif
478  T Copy();
479 
484  Topology^ ShallowCopy();
485 
490  property String^ TypeAsString
491  {
492  String^ get();
493  }
494 
499  property int Type
500  {
501  int get();
502  }
503 
510  static List<Topology^>^ Filter(List<Topology^>^ topologies, int typeFilter);
511 
512 #ifdef TOPOLOGIC_DYNAMO
513  [IsVisibleInDynamoLibrary(false)]
514 #endif
515  void RegisterFactory(const TopologicCore::Topology::Ptr& kpCoreTopology, Factories::TopologyFactory^ topologyFactory);
516 
517 #ifdef TOPOLOGIC_DYNAMO
518  [IsVisibleInDynamoLibrary(false)]
519 #endif
520  void RegisterFactory(String^ rkGUID, Factories::TopologyFactory^ topologyFactory);
521 
526  Topology^ SetDictionary(Dictionary<String^, Object^>^ dictionary);
527 
535  Topology^ SetDictionaries(List<Vertex^>^ selectors, List<Dictionary<String^, Object^>^>^ dictionaries,
536 #ifdef TOPOLOGIC_DYNAMO
537  [Autodesk::DesignScript::Runtime::DefaultArgument("255")]
538 #endif
539  int typeFilter);
540 
545  property System::Collections::Generic::Dictionary<String^, Object^>^ Dictionary
546  {
547  System::Collections::Generic::Dictionary<String^, Object^>^ get();
548  }
549 
550  public protected:
551  static Topology^ ByCoreTopology(const std::shared_ptr<TopologicCore::Topology>& kpCoreTopology);
552 
553  Object^ CleanupGeometryOutput(List<Object^>^ geometry);
554 
555  protected:
556  Topology();
557  virtual ~Topology();
558  };
559 }
A Vertex is a zero-dimensional entity equivalent to a geometry point.
Definition: Vertex.h:31
A Topology is an abstract superclass that includes constructors, properties and methods used by other...
Definition: Topology.h:53
Definition: Geometry.h:30
TopologicalQuery is the base class for Topology and Context classes.
Definition: TopologicalQuery.h:27
Definition: Dictionary.h:24
Topologic is an open-source software modelling library enabling hierarchical and topological represen...
Definition: About.h:23