OpenCPN Partial API docs
Loading...
Searching...
No Matches
select.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 *
5 ***************************************************************************
6 * Copyright (C) 2013 by David S. Register *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22 **************************************************************************/
23
24#ifndef _SELECT_H__
25#define _SELECT_H__
26
27#include "select_item.h"
28
29#define SELTYPE_UNKNOWN 0x0001
30#define SELTYPE_ROUTEPOINT 0x0002
31#define SELTYPE_ROUTESEGMENT 0x0004
32#define SELTYPE_TIDEPOINT 0x0008
33#define SELTYPE_CURRENTPOINT 0x0010
34#define SELTYPE_ROUTECREATE 0x0020
35#define SELTYPE_AISTARGET 0x0040
36#define SELTYPE_MARKPOINT 0x0080
37#define SELTYPE_TRACKSEGMENT 0x0100
38#define SELTYPE_DRAGHANDLE 0x0200
39
40class RoutePoint;
41class TrackPoint;
42class Track;
43class Route;
44
45struct SelectCtx {
46 const bool show_nav_objects;
47 const double scale;
48 SelectCtx(bool s, double _scale) : show_nav_objects(s), scale(_scale) {}
49};
50
51class Select {
52public:
53 Select();
54 ~Select();
55
56 void SetSelectPixelRadius(int radius) { pixelRadius = radius; }
57
58 bool IsSelectableRoutePointValid(RoutePoint *pRoutePoint);
59 bool AddSelectableRoutePoint(float slat, float slon,
60 RoutePoint *pRoutePointAdd);
61 bool AddSelectableRouteSegment(float slat1, float slon1, float slat2,
62 float slon2, RoutePoint *pRoutePointAdd1,
63 RoutePoint *pRoutePointAdd2, Route *pRoute);
64
65 bool AddSelectableTrackSegment(float slat1, float slon1, float slat2,
66 float slon2, TrackPoint *pTrackPointAdd1,
67 TrackPoint *pTrackPointAdd2, Track *pTrack);
68
69 SelectItem *FindSelection(SelectCtx& ctx, float slat, float slon,
70 int fseltype);
71 SelectableItemList FindSelectionList(SelectCtx& ctx, float slat, float slon,
72 int fseltype);
73
74 bool DeleteAllSelectableRouteSegments(Route *);
75 bool DeleteAllSelectableTrackSegments(Track *);
76 bool DeleteAllSelectableRoutePoints(Route *);
77 bool AddAllSelectableRouteSegments(Route *pr);
78 bool AddAllSelectableTrackSegments(Track *pr);
79 bool AddAllSelectableRoutePoints(Route *pr);
80 bool UpdateSelectableRouteSegments(RoutePoint *prp);
81 bool DeletePointSelectableTrackSegments(TrackPoint *pt);
82 bool IsSegmentSelected(float a, float b, float c, float d, float slat,
83 float slon);
84 bool IsSelectableSegmentSelected(SelectCtx& ctx, float slat, float slon,
85 SelectItem *pFindSel);
86
87 // Generic Point Support
88 // e.g. Tides/Currents and AIS Targets
89 SelectItem *AddSelectablePoint(float slat, float slon, const void *data,
90 int fseltype);
91 bool DeleteAllPoints(void);
92 bool DeleteSelectablePoint(void *data, int SeltypeToDelete);
93 bool ModifySelectablePoint(float slat, float slon, void *data, int fseltype);
94
95 // Delete all selectable points in list by type
96 bool DeleteAllSelectableTypePoints(int SeltypeToDelete);
97
98 bool DeleteSelectableRoutePoint(RoutePoint *prp);
99
100 // Accessors
101
102 SelectableItemList *GetSelectList() { return pSelectList; }
103
104private:
105 void CalcSelectRadius(SelectCtx& ctx);
106
107 SelectableItemList *pSelectList;
108 int pixelRadius;
109 float selectRadius;
110};
111
112#endif // _SELECT_H__
Definition: route.h:70
Definition: select.h:51
Definition: track.h:79
Definition: Quilt.cpp:864