1
#ifndef CSV_RENDER_PATHGRID_H
2
#define CSV_RENDER_PATHGRID_H
10
#include "../../model/world/cellcoordinates.hpp"
11
#include "../../model/world/idcollection.hpp"
12
#include "../../model/world/subcellcollection.hpp"
14
#include "tagbase.hpp"
21
class PositionAttitudeTransform;
35
class PathgridTag : public TagBase
39
PathgridTag (Pathgrid* pathgrid);
41
Pathgrid* getPathgrid () const;
43
virtual QString getToolTip (bool hideBasics) const;
54
typedef std::vector<unsigned short> NodeList;
56
Pathgrid(CSMWorld::Data& data, osg::Group* parent, const std::string& pathgridId,
57
const CSMWorld::CellCoordinates& coordinates);
61
const CSMWorld::CellCoordinates& getCoordinates() const;
62
const std::string& getId() const;
64
bool isSelected() const;
65
const NodeList& getSelected() const;
67
void toggleSelected(unsigned short node); // Adds to end of vector
68
void invertSelected();
71
void moveSelected(const osg::Vec3d& offset);
72
void setDragOrigin(unsigned short node);
73
void setDragEndpoint(unsigned short node);
74
void setDragEndpoint(const osg::Vec3d& pos);
76
void resetIndicators();
78
void applyPoint(CSMWorld::CommandMacro& commands, const osg::Vec3d& worldPos);
79
void applyPosition(CSMWorld::CommandMacro& commands);
80
void applyEdge(CSMWorld::CommandMacro& commands, unsigned short node1, unsigned short node2);
81
void applyEdges(CSMWorld::CommandMacro& commands, unsigned short node);
82
void applyRemoveNodes(CSMWorld::CommandMacro& commands);
83
void applyRemoveEdges(CSMWorld::CommandMacro& commands);
85
osg::ref_ptr<PathgridTag> getTag() const;
87
void recreateGeometry();
88
void removeGeometry();
94
CSMWorld::Data& mData;
95
CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& mPathgridCollection;
97
CSMWorld::CellCoordinates mCoords;
101
osg::Vec3d mMoveOffset;
102
unsigned short mDragOrigin;
104
bool mChangeGeometry;
105
bool mRemoveGeometry;
109
osg::ref_ptr<osg::PositionAttitudeTransform> mBaseNode;
110
osg::ref_ptr<osg::Geode> mPathgridGeode;
111
osg::ref_ptr<osg::Geometry> mPathgridGeometry;
112
osg::ref_ptr<osg::Geometry> mSelectedGeometry;
113
osg::ref_ptr<osg::Geometry> mDragGeometry;
115
osg::ref_ptr<PathgridTag> mTag;
117
void createGeometry();
118
void createSelectedGeometry();
119
void createSelectedGeometry(const CSMWorld::Pathgrid& source);
120
void removePathgridGeometry();
121
void removeSelectedGeometry();
123
void createDragGeometry(const osg::Vec3f& start, const osg::Vec3f& end, bool valid);
125
const CSMWorld::Pathgrid* getPathgridSource();
127
int edgeExists(const CSMWorld::Pathgrid& source, unsigned short node1, unsigned short node2);
128
void addEdge(CSMWorld::CommandMacro& commands, const CSMWorld::Pathgrid& source, unsigned short node1,
129
unsigned short node2);
130
void removeEdge(CSMWorld::CommandMacro& commands, const CSMWorld::Pathgrid& source, unsigned short node1,
131
unsigned short node2);
133
int clampToCell(int v);