#ifndef WXVDIGIT_DRIVER_H #define WXVDIGIT_DRIVER_H #include // debug #include #include #include // For compilers that support precompilation, includes "wx.h". #include #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP // Include your minimal set of headers here, or wx.h #include #endif #include #include #include #include extern "C" { #include #include } class DisplayDriver { private: friend class Digit; wxPseudoDC *dc; // device content /* disabled due to expensive calling dc->SetId() * * currently all objects are drawn without id * * only selected lines with id '1' * * segments with unique id (starting with '1') * are drawn only when line was selected using SelectLineByPoint() */ /* struct lineDesc { int npoints; long int startId; }; typedef std::map ids_map; ids_map ids; // gId : {dcIds, ...} */ struct ilist *selected; struct ilist *selectedDupl; bool drawSelected; bool drawSegments; // draw segments of selected line struct Map_info *mapInfo; struct line_pnts *points; // east, north, depth wxList *pointsScreen; // x, y, z struct line_cats *cats; struct _region { // GRASS region section BOUND_BOX box; // W,E,N,S,T,B double ns_res; double ew_res; double center_easting; double center_northing; // map window section double map_width; // px double map_height; double map_west; double map_north; double map_res; } region; struct symbol { bool enabled; wxColor color; }; struct _settings { wxColor highlight; symbol highlightDupl; symbol point; symbol line; symbol boundaryNo; symbol boundaryOne; symbol boundaryTwo; symbol centroidIn; symbol centroidOut; symbol centroidDup; symbol nodeOne; symbol nodeTwo; symbol vertex; symbol area; symbol direction; int lineWidth; // screen units } settings; struct _topology { long int highlight; long int point; long int line; long int boundaryNo; long int boundaryOne; long int boundaryTwo; long int centroidIn; long int centroidOut; long int centroidDup; long int nodeOne; long int nodeTwo; long int vertex; } topology; void Cell2Pixel (double, double, double, double *, double *, double *); double DistanceInPixels(double); int DrawCross(int, const wxPoint *, int size=5); int DrawArrow(double, double, double, double, double, int); int DrawLine(int); int DrawLineVerteces(int); int DrawLineNodes(int); int DrawDirectionArrow(); int DrawArea(int); /* debug */ void PrintIds(); /* select feature */ bool IsSelected(int); bool IsDuplicated(int); std::vector ListToVector(struct ilist *); int VectorToList(struct ilist *, const std::vector&); void ResetTopology(); public: /* constructor */ DisplayDriver(void *); /* destructor */ ~DisplayDriver(); /* display */ int DrawMap(bool); /* select */ int SelectLinesByBox(double, double, double, double, double, double, int); std::vector SelectLineByPoint(double, double, double, double, int, int); std::vector GetSelected(bool); std::map > GetDuplicates(); int SetSelected(std::vector); int UnSelect(std::vector); std::vector GetSelectedVertex(double, double, double); void DrawSelected(bool); /* general */ int CloseMap(); int OpenMap(const char *, const char *, bool); void ReloadMap(); void SetDevice(void *); /* misc */ std::vector GetMapBoundingBox(); /* set */ void SetRegion(double, double, double, double, double, double, double, double, double, double); void UpdateSettings(unsigned long, bool, unsigned long, bool, unsigned long, /* enabled, color */ bool, unsigned long, bool, unsigned long, bool, unsigned long, bool, unsigned long, bool, unsigned long, bool, unsigned long, bool, unsigned long, bool, unsigned long, bool, unsigned long, bool, unsigned long, bool, unsigned long, bool, unsigned long, int); }; int print_error(const char *, int); #endif /* WXVDIGIT_DRIVER_H */