WSF
WsfIntersectMesh.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WsfIntersectMesh_HPP
13#define WsfIntersectMesh_HPP
14
15#include "wsf_export.h"
16
17#include <map>
18#include <string>
19
20#include "UtDictionary.hpp"
21#include "UtIntersectMesh.hpp"
22#include "WsfComponentRoles.hpp"
23#include "WsfObject.hpp"
25class WsfPlatform;
26
31class WSF_EXPORT WsfIntersectMesh : public WsfObject, public WsfSimplePlatformComponent, public UtIntersectMesh
32{
33public:
37 ~WsfIntersectMesh() override;
38
39 WsfComponent* CloneComponent() const override;
40 void* QueryInterface(int aRole) override { return (aRole == cWSF_COMPONENT_INTERSECT_MESH) ? this : nullptr; }
41
42 WsfObject* Clone() const override;
43 bool ProcessInput(UtInput& aInput) override;
44
45 void ComponentParentChanged(WsfPlatform* aPlatformPtr) override { mPlatformPtr = aPlatformPtr; }
46
47 bool Intersect(WsfPlatform* aSourcePlatform,
48 const std::string& aTargetOffset,
49 const double aErrorAngle, // in radians
50 double& aSurfaceDotProduct,
51 int& aMaterialPropertyCode,
52 double& aDistance);
53
54 UtIntersectMesh* LookupMesh(const int aIndex);
55
56 void DefineOffset(const std::string& aOffsetName, double aOffsetX, double aOffsetY, double aOffsetZ);
57
58 bool RemoveOffset(const std::string& aOffsetName);
59
60 unsigned int GetTargetOffsetCount() { return static_cast<unsigned int>(mOffsetMap.size()); }
61
62 WsfStringId GetTargetOffsetName(unsigned aOffsetEntry) const;
63 bool TargetOffsetExists(const std::string& aTargetOffsetName) const;
64 using MeshMap = std::map<unsigned int, UtIntersectMesh*>; // convert index to meshes
65
66private:
67 struct Offset
68 {
69 Offset()
70 : x(0.0)
71 , y(0.0)
72 , z(0.0)
73 {
74 }
75 Offset(double ax, double ay, double az)
76 : x(ax)
77 , y(ay)
78 , z(az)
79 {
80 }
81
82 double x;
83 double y;
84 double z;
85 };
86 using OffsetMap = std::map<unsigned int, Offset>; // convert index to offsets
87 using OffsetNameMap = std::map<WsfStringId, int>; // convert offset name to index
88 class Shared;
89
90 int LoadMesh(const std::string& aMeshFileName);
91
92 int mMeshIndex;
93 OffsetNameMap mOffsetNameMap;
94 OffsetMap mOffsetMap;
95 Shared* mSharePtr;
96 WsfPlatform* mPlatformPtr;
97 WsfStringId mNameId;
98};
99
101
102#endif
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_INTERSECT_MESH
A 'intersect_mesh" component (WsfIntersectMesh).
Definition WsfComponentRoles.hpp:113
WsfSimpleComponentT< WsfPlatformComponent > WsfSimplePlatformComponent
Definition WsfSimpleComponent.hpp:126
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfComponent.hpp:39
virtual WsfComponent * CloneComponent() const =0
Definition WsfIntersectMesh.hpp:32
WsfIntersectMesh()
Definition WsfIntersectMesh.cpp:48
std::map< unsigned int, UtIntersectMesh * > MeshMap
Definition WsfIntersectMesh.hpp:64
void ComponentParentChanged(WsfPlatform *aPlatformPtr) override
Definition WsfIntersectMesh.hpp:45
WsfIntersectMesh & operator=(const WsfIntersectMesh &)=delete
void * QueryInterface(int aRole) override
Definition WsfIntersectMesh.hpp:40
unsigned int GetTargetOffsetCount()
Definition WsfIntersectMesh.hpp:60
Definition WsfObject.hpp:40
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
virtual WsfObject * Clone() const =0
virtual bool ProcessInput(UtInput &aInput)
Definition WsfObject.cpp:140
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Copyrights Multiple, All Rights Reserved