![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2009 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtVrfCopyPasteHandler.h,v $ $Revision: 1.1 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00011 00016 00017 #pragma once 00018 00019 #include <vrvUtil/signalslib.h> 00020 00021 #include <vrfGuiCore/vrfGuiCore.h> 00022 #include <vrfGuiCore/DtCopyObject.h> 00023 00024 #include <vrvCore/DtDe.h> 00025 #include <vrvCore/DtSimEntry.h> 00026 #include <vrvCore/DtElementEntry.h> 00027 00028 #include <matrix/geodCoord.h> 00029 00030 #include <boost/signal.hpp> 00031 00032 namespace makVrf 00033 { 00034 class DtCopyObjectCreator; 00035 class DtCopyObject; 00036 class DtVrfObjectManipulationEventProcessor; 00037 00039 class DT_DLL_VRFGUICORE DtVrfCopyPasteHandler 00040 { 00041 public: 00042 typedef std::pair<std::string, int> DtPasteInformation; 00043 typedef std::map<std::string, DtPasteInformation> DtPasteData; 00044 typedef std::map<DtCopyObject*, int> DtObjectsCopying; 00045 typedef std::vector<DtCopyObject*> DtObjectsDeleting; 00046 typedef std::vector<DtCopyObject*> DtObjectsPasting; 00047 00048 public: 00049 DtVrfCopyPasteHandler(makVrv::DtDe&); 00050 virtual ~DtVrfCopyPasteHandler(); 00051 00052 public: 00054 const DtPasteData& pasteData() const 00055 { 00056 return myPasteData; 00057 } 00058 00060 virtual void clearPasteData(); 00061 00064 virtual void copy(const makVrv::DtUniqueID& id); 00065 00066 bool canCopy() const 00067 { 00068 return (myObjectsCopying.size() == 0); 00069 } 00070 00071 int numCopying() const 00072 { 00073 return myObjectsCopying.size(); 00074 } 00075 00076 bool canPaste() const 00077 { 00078 return ((myPasteData.size() != 0) && !pasting()); 00079 } 00080 00083 virtual void stop(); 00084 00086 virtual void cancelPaste(); 00087 00090 virtual void cancelled(DtCopyObject*); 00091 00094 virtual void copied(DtCopyObject*, const std::string&); 00095 00097 virtual void tick(); 00098 00100 virtual void copyOperationPending(DtCopyObject*, const std::string&); 00101 00103 virtual DtCopyObject* createCopyObject(const makVrv::DtElementEntry&) const; 00104 00106 virtual DtCopyObject* createCopyObject(int type) const = 0; 00107 00108 void setPasteFlags(int f) 00109 { 00110 myPasteFlags = f; 00111 } 00112 00113 int pasteFlags() const 00114 { 00115 return myPasteFlags; 00116 } 00117 00118 bool hasObjectsToPaste() const 00119 { 00120 return (myObjectsPasting.size() != 0); 00121 } 00122 00123 public: 00127 virtual void paste(const DtVector& at = DtVector(), int flags = 00128 DtCopyObject::DtAllPasteFlags); 00129 00131 bool pasting() const 00132 { 00133 return myEventProcessor != 0; 00134 } 00135 00138 void setMaximumToProcessInPastePass(int i) 00139 { 00140 myMaximumToProcessInPastePass = i; 00141 } 00142 00143 int maximumToProcessInPastePass() const 00144 { 00145 return myMaximumToProcessInPastePass; 00146 } 00147 00149 virtual void cleanup(); 00150 00152 virtual DtCopyObject* createObjectFromPasteData(int type, const std::string& buffer) const; 00153 00155 virtual void queueObjectsToPaste(); 00156 00158 virtual void slot_onPaste(); 00159 00160 const DtObjectsPasting& objectsPasting() const 00161 { 00162 return myObjectsPasting; 00163 } 00164 00165 virtual void setPasteData(const std::string& name, int type, const std::string& pasteBuffer); 00166 00167 protected: 00168 00171 virtual void pasted(DtCopyObject*); 00172 00175 virtual void removeFromCopying(DtCopyObject*); 00176 00179 virtual void cleanupEventProcessor(); 00180 00181 protected: 00183 virtual void slot_onLocationChanged(const DtVector&, double); 00184 00186 virtual void pasteOperationPending(DtCopyObject*, const std::string&); 00187 00190 virtual void pasteCancelled(DtCopyObject*); 00191 00194 virtual void removeFromBeingPasted(DtCopyObject*); 00195 00196 public: 00198 boost::signal<void (bool)> signal_hasPasteData; 00199 boost::signal<void ()> signal_stopped; 00200 boost::signal<void (DtCopyObject*)> signal_copyCancelled; 00201 boost::signal<void (DtCopyObject*, const std::string&)> signal_copied; 00202 boost::signal<void ()> signal_copyComplete; 00203 boost::signal<void (DtCopyObject*, const std::string&)> signal_copyOperationPending; 00204 00205 boost::signal<void ()> signal_pasting; 00206 boost::signal<void ()> signal_pasteComplete; 00207 boost::signal<void (DtCopyObject*)> signal_pasted; 00208 boost::signal<void (DtCopyObject*)> signal_pasteCancelled; 00209 boost::signal<void (DtCopyObject*, const std::string&)> signal_pasteOperationPending; 00210 00211 protected: 00212 makVrv::DtDe& myDe; 00213 00215 DtPasteData myPasteData; 00216 DtObjectsCopying myObjectsCopying; 00217 DtObjectsPasting myObjectsPasting; 00218 DtObjectsPasting myObjectsBeingPasted; 00219 DtObjectsPasting myObjectsToPaste; 00220 DtObjectsDeleting myToDelete; 00221 DtVrfObjectManipulationEventProcessor* myEventProcessor; 00222 int myMaximumToProcessInPastePass; 00223 int myPasteFlags; 00224 bool myQueueing; 00225 DtGeodeticCoord myOrigin; 00226 DtReferenceEllipsoid myReferenceEllipsoid; 00227 }; 00228 }