Przeglądaj źródła

ENH:dah adds new type bindings + start functions

Benoît Bleuzé 14 lat temu
rodzic
commit
3e87ac6339

+ 20 - 19
Applications/ctkExampleHost/ctkExampleHostMain.cpp

@@ -28,6 +28,7 @@
 #include <QStringList>
 #include <QStringList>
 #include <QDirIterator>
 #include <QDirIterator>
 #include <QWidget>
 #include <QWidget>
+#include <QUrl>
 
 
 int main(int argv, char** argc)
 int main(int argv, char** argc)
 {
 {
@@ -57,25 +58,25 @@ int main(int argv, char** argc)
 
 
   qApp->addLibraryPath(pluginPath);
   qApp->addLibraryPath(pluginPath);
 
 
-//  QStringList libFilter;
-//  libFilter << "*.dll" << "*.so" << "*.dylib";
-//  QDirIterator dirIter(pluginPath, libFilter, QDir::Files);
-//  while(dirIter.hasNext())
-//  {
-//    try
-//    {
-//      QString fileLocation = dirIter.next();
-//      if (fileLocation.contains("org_commontk_dicom_wg23"))
-//      {
-//        ctkPlugin* plugin = framework->getPluginContext()->installPlugin(QUrl::fromLocalFile(fileLocation));
-//        plugin->start(ctkPlugin::START_TRANSIENT);
-//      }
-//    }
-//    catch (const ctkPluginException& e)
-//    {
-//      qCritical() << e.what();
-//    }
-//  }
+  QStringList libFilter;
+  libFilter << "*.dll" << "*.so" << "*.dylib";
+  QDirIterator dirIter(pluginPath, libFilter, QDir::Files);
+  while(dirIter.hasNext())
+  {
+    try
+    {
+      QString fileLocation = dirIter.next();
+      if (fileLocation.contains("org_commontk_dicom_wg23"))
+      {
+        ctkPlugin* plugin = framework->getPluginContext()->installPlugin(QUrl::fromLocalFile(fileLocation));
+        plugin->start(ctkPlugin::START_TRANSIENT);
+      }
+    }
+    catch (const ctkPluginException& e)
+    {
+      qCritical() << e.what();
+    }
+  }
 
 
   framework->start();
   framework->start();
 
 

+ 2 - 0
Plugins/org.commontk.dicom.wg23.core/CMakeLists.txt

@@ -19,6 +19,8 @@ SET(PLUGIN_SRCS
   ctkDicomWG23CorePlugin.cpp
   ctkDicomWG23CorePlugin.cpp
   ctkSimpleSoapServer.cpp
   ctkSimpleSoapServer.cpp
   ctkSoapConnectionRunnable.cpp
   ctkSoapConnectionRunnable.cpp
+  ctkDicomWG23Types.h
+  ctkDicomWG23TypesHelper.h
 )
 )
 
 
 # Files which should be processed by Qts moc
 # Files which should be processed by Qts moc

+ 2 - 2
Plugins/org.commontk.dicom.wg23.core/ctkDicomExchangeInterface.h

@@ -39,8 +39,8 @@ public:
   // Data exchange interface methods
   // Data exchange interface methods
   //
   //
 
 
-  virtual bool notifyDataAvailable(ctkDicomWG23::AvailableData data, bool lastData) = 0;
-  virtual QList<ctkDicomWG23::ObjectLocator> getData(QList<QUuid> objectUUIDs, QList<QString> acceptableTransferSyntaxUIDs, bool includeBulkData) = 0;
+  //virtual bool notifyDataAvailable(ctkDicomWG23::AvailableData data, bool lastData) = 0;
+  //virtual QList<ctkDicomWG23::ObjectLocator> getData(QList<QUuid> objectUUIDs, QList<QString> acceptableTransferSyntaxUIDs, bool includeBulkData) = 0;
 
 
   //    8.3.3 getAsModels(objectUUIDs : ArrayOfUUID, classUID : UID, supportedInfosetTypes : ArrayOfMimeType) : ModelSetDescriptor	33
   //    8.3.3 getAsModels(objectUUIDs : ArrayOfUUID, classUID : UID, supportedInfosetTypes : ArrayOfMimeType) : ModelSetDescriptor	33
 //    8.3.4 queryModel(models : ArrayOfUUID, xpaths : ArrayOfString) : ArrayOfQueryResult	34
 //    8.3.4 queryModel(models : ArrayOfUUID, xpaths : ArrayOfString) : ArrayOfQueryResult	34

+ 60 - 4
Plugins/org.commontk.dicom.wg23.core/ctkDicomWG23TypesHelper.h

@@ -24,16 +24,72 @@
 #define CTKDICOM23TYPESHELPER_H
 #define CTKDICOM23TYPESHELPER_H
 
 
 #include <QtSoapStruct>
 #include <QtSoapStruct>
-#include <QtSoapName>
+#include <QtSoapQName>
 #include <QRect>
 #include <QRect>
 
 
-class ctkDicomSoapRectangle (QtSoapStruct) {
+class ctkDicomSoapRectangle :public QtSoapStruct {
 
 
-    ctkDicomSoapRectangle(Const QtSoapName & name,Const QRect rect):QtSoapStruct(){
+    ctkDicomSoapRectangle(const QtSoapQName & name,const QRect& rect):QtSoapStruct(name){
+        this->insert(new QtSoapSimpleType(QtSoapQName("Height"), 
+                    rect.height()));
+        this->insert(new QtSoapSimpleType(QtSoapQName("Width"), 
+                    rect.width()));
+        this->insert(new QtSoapSimpleType(QtSoapQName("RefPointX"),
+                    rect.x()));
+        this->insert(new QtSoapSimpleType(QtSoapQName("RefPointY"), 
+                    rect.y()));
 
 
     };
     };
 
 
-    static QRect getQRect (Const QtSoapType& type);
+    static QRect getQRect (const QtSoapType& type){
+        return QRect (type["RefPointX"].value().toInt(),
+                        type["RefPointY"].value().toInt(),
+                        type["Width"].value().toInt(),
+                        type["Height"].value().toInt());
+    };
+};
+
+class ctkDicomSoapState : public QtSoapSimpleType{
+   ctkDicomSoapState ( const QtSoapQName & name, ctkDicomWG23::State s ):
+       QtSoapSimpleType ( name, s ){};
+
+   static ctkDicomWG23::State getState(const QtSoapType& type){
+        return  static_cast<ctkDicomWG23::State> (type.value().toInt());
+   };
+};
+
+
+class ctkDicomSoapStatus : public QtSoapStruct{
+    ctkDicomSoapStatus ( const QtSoapQName & name,
+            const ctkDicomWG23::Status* s ):
+       QtSoapStruct ( name ){
+        this->insert(new QtSoapSimpleType(QtSoapQName("StatusType"), 
+                    s->statusType) );
+        this->insert(new QtSoapSimpleType(
+                    QtSoapQName("CodingSchemeDesignator"), 
+                    s->codingSchemeDesignator) );
+        this->insert(new QtSoapSimpleType(
+                    QtSoapQName("CodeValue"), 
+                    s->codeValue) );
+        this->insert(new QtSoapSimpleType(
+                    QtSoapQName("CodeMeaning"), 
+                    s->codeMeaning) );
+    };
+   static ctkDicomWG23::Status getStatus(const QtSoapType& type){
+        ctkDicomWG23::Status s;
+        
+        s.statusType = static_cast<ctkDicomWG23::StatusType>
+            (type["StatusType"].value().toInt());
+        s.codingSchemeDesignator = 
+            type["CodingSchemeDesignator"].value().toString();
+        s.codeValue = 
+            type["CodeValue"].value().toString();
+        s.codeMeaning = 
+            type["CodeMeaning"].value().toString();
+        return s;
+   };
 };
 };
 
 
+
+
 #endif
 #endif

+ 1 - 0
Plugins/org.commontk.dicom.wg23.core/ctkSimpleSoapServer.h

@@ -28,6 +28,7 @@
 #include <qtsoap.h>
 #include <qtsoap.h>
 
 
 #include <org_commontk_dicom_wg23_core_Export.h>
 #include <org_commontk_dicom_wg23_core_Export.h>
+#include <ctkDicomWG23Types.h>
 
 
 class org_commontk_dicom_wg23_core_EXPORT ctkSimpleSoapServer : public QTcpServer
 class org_commontk_dicom_wg23_core_EXPORT ctkSimpleSoapServer : public QTcpServer
 {
 {

+ 27 - 0
Plugins/org.commontk.dicom.wg23.host/ctkDicomHostServerPrivate.cpp

@@ -29,6 +29,7 @@
 #include <QHostAddress>
 #include <QHostAddress>
 
 
 #include <stdexcept>
 #include <stdexcept>
+#include <ctkDicomWG23TypesHelper.h>
 
 
 ctkDicomHostServerPrivate::ctkDicomHostServerPrivate(QObject *parent) :
 ctkDicomHostServerPrivate::ctkDicomHostServerPrivate(QObject *parent) :
     QObject(parent)
     QObject(parent)
@@ -64,6 +65,14 @@ void ctkDicomHostServerPrivate::incomingSoapMessage(const QtSoapMessage& message
   {
   {
     processGetAvailableScreen(message, reply);
     processGetAvailableScreen(message, reply);
   }
   }
+  if (methodName == "notifyStateChanged")
+  {
+    processNotifyStateChanged(message, reply);
+  }
+  if (methodName == "notifyStatus")
+  {
+    processNotifyStatus(message, reply);
+  }
 }
 }
 
 
 void ctkDicomHostServerPrivate::processGetAvailableScreen(
 void ctkDicomHostServerPrivate::processGetAvailableScreen(
@@ -85,3 +94,21 @@ void ctkDicomHostServerPrivate::processGetAvailableScreen(
   availableScreenType->insert(new QtSoapSimpleType(QtSoapQName("RefPointY"), result.y()));
   availableScreenType->insert(new QtSoapSimpleType(QtSoapQName("RefPointY"), result.y()));
   reply->addMethodArgument(availableScreenType);
   reply->addMethodArgument(availableScreenType);
 }
 }
+
+void ctkDicomHostServerPrivate::processNotifyStateChanged(
+    const QtSoapMessage &message, QtSoapMessage *reply)
+{
+    ctkDicomWG23::State state;
+    const QtSoapType& stateType = message.method()["state"];
+
+
+
+}
+
+void ctkDicomHostServerPrivate::processNotifyStatus(
+    const QtSoapMessage &message, QtSoapMessage *reply)
+{
+    ctkDicomWG23::State state;
+    const QtSoapType& stateType = message.method()["status"];
+
+}

+ 4 - 0
Plugins/org.commontk.dicom.wg23.host/ctkDicomHostServerPrivate.h

@@ -48,6 +48,10 @@ private:
 
 
   void processGetAvailableScreen(const QtSoapMessage& message,
   void processGetAvailableScreen(const QtSoapMessage& message,
                                  QtSoapMessage* reply);
                                  QtSoapMessage* reply);
+  void processNotifyStateChanged(const QtSoapMessage& message,
+                                 QtSoapMessage* reply);
+  void processNotifyStatus(const QtSoapMessage& message,
+                                 QtSoapMessage* reply);
 
 
   ctkDicomHostInterface* serviceBinding;
   ctkDicomHostInterface* serviceBinding;