LocalizationMapEntity.cpp
00001 #include "LocalizationMapEntity.h"
00002
00003 LocalizationMapEntity::LocalizationMapEntity()
00004 {
00005
00006 }
00007
00008 LocalizationMapEntity::LocalizationMapEntity(Point2D<float> center, float orientation, Point2D<float> dim, int shapeType, PixRGB<byte> color, int objectType, int interactionType, int fillType)
00009 {
00010 mCenter = center;
00011 mOrientation = orientation;
00012 mDim = dim;
00013 mShapeType = shapeType;
00014 mFillType = fillType;
00015 mObjectType = objectType;
00016 mColor = color;
00017 mInteractionType = interactionType;
00018 }
00019
00020 void LocalizationMapEntity::drawMe(Image<PixRGB<byte> > &img, const Camera cam)
00021 {
00022 drawShape(img, cam);
00023
00024 }
00025
00026 void LocalizationMapEntity::drawShape(Image<PixRGB<byte> > &img, const Camera cam)
00027 {
00028 Point2D<int> thePoint = Point2D<int> (
00029 round((mCenter.i - cam.mCenter.i) * cam.mScale),
00030 -round((mCenter.j + cam.mCenter.j) * cam.mScale)
00031 );
00032 thePoint += Point2D<int> (img.getWidth() / 2, img.getHeight() / 2);
00033 Dims theDim = Dims(cam.mScale * mDim.i, cam.mScale * mDim.j);
00034 Rectangle theRect = Rectangle(Point2D<int>(thePoint.i, thePoint.j), theDim);
00035 switch(mShapeType)
00036 {
00037 case ShapeType::rect:
00038 theRect = Rectangle(Point2D<int>(thePoint.i - theDim.w() / 2, thePoint.j - theDim.h() / 2), theDim);
00039 drawRectOR(img, theRect, mColor, 1, D_DEGREE * (mOrientation + 90.0));
00040 break;
00041 case ShapeType::line:
00042 drawLine(img, thePoint, mOrientation * D_DEGREE, mDim.i * cam.mScale, mColor, 1);
00043 break;
00044 case ShapeType::square:
00045 theRect = Rectangle(Point2D<int>(thePoint.i - theDim.w() / 2, thePoint.j - theDim.h() / 2), theDim);
00046 drawRectOR(img, theRect, mColor, 1, D_DEGREE * (mOrientation + 90.0));
00047 break;
00048 case ShapeType::circle:
00049 drawCircle(img, thePoint, mDim.i * cam.mScale / 2, mColor, 1);
00050 break;
00051 }
00052
00053 }
00054
00055 void LocalizationMapEntity::drawBackground(Image<PixRGB<byte> > &img, const Camera cam, Rectangle theRect)
00056 {
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 }