VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vrfCopyPasteHandler.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>
19 #include <vrfGuiCore/copyObject.h>
20 
21 #include <vrvCore/DtDe.h>
22 #include <vrvCore/DtSimEntry.h>
23 #include <vrvCore/DtElementEntry.h>
24 
25 #include <matrix/geodeticCoord.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 
171  virtual void registerName(const DtString&);
172  virtual bool nameIsRegistered(const DtString&) const;
174 
175  protected:
176 
179  virtual void pasted(DtCopyObject*);
180 
183  virtual void removeFromCopying(DtCopyObject*);
184 
187  virtual void cleanupEventProcessor();
188 
189  protected:
191  virtual void slot_onLocationChanged(const DtVector&, double);
192 
194  virtual void pasteOperationPending(DtCopyObject*, const std::string&);
195 
198  virtual void pasteCancelled(DtCopyObject*);
199 
202  virtual void removeFromBeingPasted(DtCopyObject*);
203 
204  public:
206  boost::signal<void (bool)> signal_hasPasteData;
207  boost::signal<void ()> signal_stopped;
208  boost::signal<void (DtCopyObject*)> signal_copyCancelled;
209  boost::signal<void (DtCopyObject*, const std::string&)> signal_copied;
210  boost::signal<void ()> signal_copyComplete;
211  boost::signal<void (DtCopyObject*, const std::string&)> signal_copyOperationPending;
212 
213  boost::signal<void ()> signal_pasting;
214  boost::signal<void ()> signal_pasteComplete;
215  boost::signal<void (DtCopyObject*)> signal_pasted;
216  boost::signal<void (DtCopyObject*)> signal_pasteCancelled;
217  boost::signal<void (DtCopyObject*, const std::string&)> signal_pasteOperationPending;
218 
219  protected:
221 
233  DtGeodeticCoord myOrigin;
234  DtReferenceEllipsoid myReferenceEllipsoid;
235 
237 
238  std::set<DtString> myRegisteredNames;
239  };
240 }

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)