VR-Forces 4.1.1 Class Documentation
DtVrfCopyPasteHandler.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
13 
14 #pragma once
15 
16 #include <vrvUtil/signalslib.h>
17 
18 #include <vrfGuiCore/vrfGuiCore.h>
20 
21 #include <vrvCore/DtDe.h>
22 #include <vrvCore/DtSimEntry.h>
23 #include <vrvCore/DtElementEntry.h>
24 
25 #include <matrix/geodCoord.h>
26 
27 #include <boost/signal.hpp>
28 
29 namespace makVrf
30 {
31  class DtCopyObjectCreator;
32  class DtCopyObject;
33  class DtVrfObjectManipulationEventProcessor;
34 
37  {
38  public:
39  typedef std::pair<std::string, int> DtPasteInformation;
40  typedef std::map<std::string, DtPasteInformation> DtPasteData;
41  typedef std::map<DtCopyObject*, int> DtObjectsCopying;
42  typedef std::vector<DtCopyObject*> DtObjectsDeleting;
43  typedef std::vector<DtCopyObject*> DtObjectsPasting;
44 
45  public:
47  virtual ~DtVrfCopyPasteHandler();
48 
49  public:
51  const DtPasteData& pasteData() const
52  {
53  return myPasteData;
54  }
55 
57  virtual void clearPasteData();
58 
61  virtual void copy(const makVrv::DtUniqueID& id);
62 
63  virtual bool canCopy() const
64  {
65  return (myObjectsCopying.size() == 0);
66  }
67 
68  int numCopying() const
69  {
70  return myObjectsCopying.size();
71  }
72 
73  virtual bool canPaste() const
74  {
75  return ((myPasteData.size() != 0) && !pasting());
76  }
77 
80  virtual void stop();
81 
83  virtual void cancelPaste();
84 
87  virtual void cancelled(DtCopyObject*);
88 
91  virtual void copied(DtCopyObject*, const std::string&);
92 
94  virtual void tick();
95 
97  virtual void copyOperationPending(DtCopyObject*, const std::string&);
98 
100  virtual DtCopyObject* createCopyObject(const makVrv::DtElementEntry&) const;
101 
103  virtual DtCopyObject* createCopyObject(int type) const = 0;
104 
105  void setPasteFlags(int f)
106  {
107  myPasteFlags = f;
108  }
109 
110  int pasteFlags() const
111  {
112  return myPasteFlags;
113  }
114 
115  bool hasObjectsToPaste() const
116  {
117  return (myObjectsPasting.size() != 0);
118  }
119 
121  virtual void setPreserveOffsets(bool);
122  virtual bool preserveOffsets() const;
123 
124  public:
128  virtual void paste(const DtVector& at = DtVector(), int flags =
130 
132  bool pasting() const
133  {
134  return myEventProcessor != 0;
135  }
136 
139  void setMaximumToProcessInPastePass(int i)
140  {
141  myMaximumToProcessInPastePass = i;
142  }
143 
144  int maximumToProcessInPastePass() const
145  {
146  return myMaximumToProcessInPastePass;
147  }
148 
150  virtual void cleanup();
151 
153  virtual DtCopyObject* createObjectFromPasteData(int type, const std::string& buffer) const;
154 
156  virtual void queueObjectsToPaste();
157 
159  virtual void slot_onPaste();
160 
161  const DtObjectsPasting& objectsPasting() const
162  {
163  return myObjectsPasting;
164  }
165 
166  virtual void setPasteData(const std::string& name, int type, const std::string& pasteBuffer);
167 
168  protected:
169 
172  virtual void pasted(DtCopyObject*);
173 
176  virtual void removeFromCopying(DtCopyObject*);
177 
180  virtual void cleanupEventProcessor();
181 
182  protected:
184  virtual void slot_onLocationChanged(const DtVector&, double);
185 
187  virtual void pasteOperationPending(DtCopyObject*, const std::string&);
188 
191  virtual void pasteCancelled(DtCopyObject*);
192 
195  virtual void removeFromBeingPasted(DtCopyObject*);
196 
197  public:
199  boost::signal<void (bool)> signal_hasPasteData;
200  boost::signal<void ()> signal_stopped;
201  boost::signal<void (DtCopyObject*)> signal_copyCancelled;
202  boost::signal<void (DtCopyObject*, const std::string&)> signal_copied;
203  boost::signal<void ()> signal_copyComplete;
204  boost::signal<void (DtCopyObject*, const std::string&)> signal_copyOperationPending;
205 
206  boost::signal<void ()> signal_pasting;
207  boost::signal<void ()> signal_pasteComplete;
208  boost::signal<void (DtCopyObject*)> signal_pasted;
209  boost::signal<void (DtCopyObject*)> signal_pasteCancelled;
210  boost::signal<void (DtCopyObject*, const std::string&)> signal_pasteOperationPending;
211 
212  protected:
214 
226  DtGeodeticCoord myOrigin;
227  DtReferenceEllipsoid myReferenceEllipsoid;
228 
230  };
231 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)