diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index 0030fd9b8..e7b135891 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -307,7 +307,13 @@ void CSVRender::Cell::setCellArrows (int mask) void CSVRender::Cell::setCellMarker() { - mCellMarker.reset(new CellMarker(mCellNode, mCoordinates)); + bool cellExists = false; + int cellIndex = mData.getCells().searchId(mId); + if (cellIndex > -1) + { + cellExists = !mData.getCells().getRecord(cellIndex).isDeleted(); + } + mCellMarker.reset(new CellMarker(mCellNode, mCoordinates, cellExists)); } CSMWorld::CellCoordinates CSVRender::Cell::getCoordinates() const diff --git a/apps/opencs/view/render/cellmarker.cpp b/apps/opencs/view/render/cellmarker.cpp index e8772a586..e0d270f85 100644 --- a/apps/opencs/view/render/cellmarker.cpp +++ b/apps/opencs/view/render/cellmarker.cpp @@ -22,14 +22,27 @@ void CSVRender::CellMarker::buildMarker() { const int characterSize = 20; - // Set up marker text containing cell's coordinates. + // Set up attributes of marker text. osg::ref_ptr markerText (new osgText::Text); - markerText->setBackdropType(osgText::Text::OUTLINE); markerText->setLayout(osgText::Text::LEFT_TO_RIGHT); markerText->setCharacterSize(characterSize); + markerText->setAlignment(osgText::Text::CENTER_CENTER); + markerText->setDrawMode(osgText::Text::TEXT | osgText::Text::FILLEDBOUNDINGBOX); + + // If cell exists then show black bounding box otherwise show red. + if (mExists) + { + markerText->setBoundingBoxColor(osg::Vec4f(0.0f, 0.0f, 0.0f, 1.0f)); + } + else + { + markerText->setBoundingBoxColor(osg::Vec4f(1.0f, 0.0f, 0.0f, 1.0f)); + } + + // Add text containing cell's coordinates. std::string coordinatesText = - "#" + boost::lexical_cast(mCoordinates.getX()) + - " " + boost::lexical_cast(mCoordinates.getY()); + boost::lexical_cast(mCoordinates.getX()) + "," + + boost::lexical_cast(mCoordinates.getY()); markerText->setText(coordinatesText); // Add text to marker node. @@ -51,9 +64,11 @@ void CSVRender::CellMarker::positionMarker() CSVRender::CellMarker::CellMarker( osg::Group *cellNode, - const CSMWorld::CellCoordinates& coordinates + const CSMWorld::CellCoordinates& coordinates, + const bool cellExists ) : mCellNode(cellNode), - mCoordinates(coordinates) + mCoordinates(coordinates), + mExists(cellExists) { // Set up node for cell marker. mMarkerNode = new osg::AutoTransform(); diff --git a/apps/opencs/view/render/cellmarker.hpp b/apps/opencs/view/render/cellmarker.hpp index 08c7e0608..4246b20b8 100644 --- a/apps/opencs/view/render/cellmarker.hpp +++ b/apps/opencs/view/render/cellmarker.hpp @@ -38,6 +38,7 @@ namespace CSVRender osg::Group* mCellNode; osg::ref_ptr mMarkerNode; CSMWorld::CellCoordinates mCoordinates; + bool mExists; // Not implemented. CellMarker(const CellMarker&); @@ -46,7 +47,7 @@ namespace CSVRender /// \brief Build marker containing cell's coordinates. void buildMarker(); - /// \brief Position marker above center of cell. + /// \brief Position marker at center of cell. void positionMarker(); public: @@ -54,9 +55,11 @@ namespace CSVRender /// \brief Constructor. /// \param cellNode Cell to create marker for. /// \param coordinates Coordinates of cell. + /// \param cellExists Whether or not cell exists. CellMarker( osg::Group *cellNode, - const CSMWorld::CellCoordinates& coordinates); + const CSMWorld::CellCoordinates& coordinates, + const bool cellExists); ~CellMarker(); };