Permalink
Browse files

Refactoring: more classes separated from 'navutil' to their own files…

… (cpp, h).
  • Loading branch information...
mariokonrad committed Mar 27, 2013
1 parent 2975281 commit e1602ad91492a5b3f160a5d5d8264dcdb00d9b8e
View
@@ -3,3 +3,4 @@ tags
index.sh
include/version.h
build
+cscope.out
View
@@ -342,6 +342,7 @@ SET(HDRS
include/ocpCursor.h
include/Quilt.h
include/Hyperlink.h
+ include/NavObjectCollection.h
include/RoutePoint.h
include/Route.h
include/SelectItem.h
@@ -353,6 +354,7 @@ SET(HDRS
include/OCPN_Sound.h
include/TTYWindow.h
include/TTYScroll.h
+ include/Layer.h
include/concanv.h
include/cutil.h
include/georef.h
@@ -407,6 +409,8 @@ SET(SRCS
src/ChInfoWin.cpp
src/AISTargetQueryDialog.cpp
src/Quilt.cpp
+ src/Hyperlink.cpp
+ src/NavObjectCollection.cpp
src/RoutePoint.cpp
src/Route.cpp
src/SelectItem.cpp
@@ -417,6 +421,7 @@ SET(SRCS
src/OCPN_Sound.cpp
src/TTYWindow.cpp
src/TTYScroll.cpp
+ src/Layer.cpp
src/concanv.cpp
src/cutil.cpp
src/georef.cpp
View
@@ -0,0 +1,59 @@
+/******************************************************************************
+ *
+ * Project: OpenCPN
+ *
+ ***************************************************************************
+ * Copyright (C) 2010 by David S. Register *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************
+ */
+
+#ifndef __LAYER_H__
+#define __LAYER_H__
+
+#include <wx/string.h>
+#include <wx/list.h>
+#include <wx/datetime.h>
+
+class Layer
+{
+public:
+ Layer(void);
+ ~Layer(void);
+ wxString CreatePropString(void) { return m_LayerFileName; }
+ bool IsVisibleOnChart() { return m_bIsVisibleOnChart; }
+ void SetVisibleOnChart(bool viz = true){ m_bIsVisibleOnChart = viz; }
+ bool IsVisibleOnListing() { return m_bIsVisibleOnListing; }
+ void SetVisibleOnListing(bool viz = true){ m_bIsVisibleOnListing = viz; }
+ bool HasVisibleNames() { return m_bHasVisibleNames; }
+ void SetVisibleNames(bool viz = true){ m_bHasVisibleNames = viz; }
+
+ bool m_bIsVisibleOnChart;
+ bool m_bIsVisibleOnListing;
+ bool m_bHasVisibleNames;
+ long m_NoOfItems;
+ int m_LayerID;
+
+ wxString m_LayerName;
+ wxString m_LayerFileName;
+ wxString m_LayerDescription;
+ wxDateTime m_CreateTime;
+};
+
+WX_DECLARE_LIST(Layer, LayerList);// establish class as list member
+
+#endif
@@ -0,0 +1,49 @@
+/******************************************************************************
+ *
+ * Project: OpenCPN
+ *
+ ***************************************************************************
+ * Copyright (C) 2010 by David S. Register *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************
+ */
+
+#ifndef __NAVOBJECTCOLLECTION_H__
+#define __NAVOBJECTCOLLECTION_H__
+
+#include "gpxdocument.h"
+
+class TiXmlNode;
+
+class NavObjectCollection : public GpxDocument
+{
+ public:
+ NavObjectCollection();
+ ~NavObjectCollection();
+
+ bool CreateNavObjGPXPoints(void);
+ bool CreateNavObjGPXRoutes(void);
+ bool CreateNavObjGPXTracks(void);
+
+ bool LoadAllGPXObjects(void);
+
+ private:
+ GpxRootElement *m_pXMLrootnode;
+ TiXmlNode *m_proot_next;
+};
+
+#endif
View
@@ -69,8 +69,6 @@ class NavObjectCollection;
class wxProgressDialog;
class ocpnDC;
-#define TIMER_TRACK1 778
-
//----------------------------------------------------------------------------
// Track
//----------------------------------------------------------------------------
@@ -132,38 +130,6 @@ class Track : public wxEvtHandler, public Route
DECLARE_EVENT_TABLE()
};
-//----------------------------------------------------------------------------
-// Layer
-//----------------------------------------------------------------------------
-
-class Layer
-{
-public:
- Layer(void);
- ~Layer(void);
- wxString CreatePropString(void) { return m_LayerFileName; }
- bool IsVisibleOnChart() { return m_bIsVisibleOnChart; }
- void SetVisibleOnChart(bool viz = true){ m_bIsVisibleOnChart = viz; }
- bool IsVisibleOnListing() { return m_bIsVisibleOnListing; }
- void SetVisibleOnListing(bool viz = true){ m_bIsVisibleOnListing = viz; }
- bool HasVisibleNames() { return m_bHasVisibleNames; }
- void SetVisibleNames(bool viz = true){ m_bHasVisibleNames = viz; }
-
- bool m_bIsVisibleOnChart;
- bool m_bIsVisibleOnListing;
- bool m_bHasVisibleNames;
- long m_NoOfItems;
- int m_LayerID;
-
- wxString m_LayerName;
- wxString m_LayerFileName;
- wxString m_LayerDescription;
- wxDateTime m_CreateTime;
-
-};
-
-WX_DECLARE_LIST(Layer, LayerList);// establish class as list member
-
//----------------------------------------------------------------------------
// Static XML Helpers
//----------------------------------------------------------------------------
@@ -248,28 +214,6 @@ class MyConfig:public wxFileConfig
};
-
-//---------------------------------------------------------------------------------
-// XML Based NavObjectSet
-//---------------------------------------------------------------------------------
-
-class NavObjectCollection : public GpxDocument
-{
- public:
- NavObjectCollection();
- ~NavObjectCollection();
-
- bool CreateNavObjGPXPoints(void);
- bool CreateNavObjGPXRoutes(void);
- bool CreateNavObjGPXTracks(void);
-
- bool LoadAllGPXObjects(void);
-
- private:
- GpxRootElement *m_pXMLrootnode;
- TiXmlNode *m_proot_next;
-};
-
/*
#include <wx/fontdlg.h>
View
@@ -0,0 +1,29 @@
+/******************************************************************************
+ *
+ * Project: OpenCPN
+ *
+ ***************************************************************************
+ * Copyright (C) 2013 by David S. Register *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************
+ */
+
+#include "Hyperlink.h"
+
+#include <wx/listimpl.cpp>
+WX_DEFINE_LIST ( HyperlinkList ); // toh, 2009.02.22
+
View
@@ -0,0 +1,53 @@
+/******************************************************************************
+ *
+ * Project: OpenCPN
+ *
+ ***************************************************************************
+ * Copyright (C) 2010 by David S. Register *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************
+ */
+
+#include "Layer.h"
+
+#include <wx/listimpl.cpp>
+WX_DEFINE_LIST(LayerList);
+
+extern bool g_bShowLayers;
+extern LayerList *pLayerList;
+
+Layer::Layer( void )
+{
+ m_bIsVisibleOnChart = g_bShowLayers;
+ m_bIsVisibleOnListing = false;
+ m_bHasVisibleNames = true;
+ m_NoOfItems = 0;
+
+ m_LayerName = _T("");
+ m_LayerFileName = _T("");
+ m_LayerDescription = _T("");
+ m_CreateTime = wxDateTime::Now();
+}
+
+Layer::~Layer( void )
+{
+// Remove this layer from the global layer list
+ if( NULL != pLayerList ) pLayerList->DeleteObject( this );
+
+}
+
+
Oops, something went wrong.

0 comments on commit e1602ad

Please sign in to comment.