//=========================================================================
GBlackBoxModel::GBlackBoxModel()
- {
-
-
+ {
}
//=========================================================================
}
//=========================================================================
+ void GBlackBoxModel::updateBlackBox(BlackBoxDescriptor::Pointer descriptor)//virtual
+ {
+ _desc=descriptor;
+ std::cout<<"RaC Box author:"<<_desc->GetAuthor()<<std::endl;
+ }
+ //=========================================================================
} // EO namespace bbtk
// EOF
//Includes std
#include <iostream>
+
namespace bbtk
{
GBlackBoxModel();
~GBlackBoxModel();
- //Public methods
-
+ //Public methods
+ virtual void updateBlackBox(BlackBoxDescriptor::Pointer descriptor);
private:
//Attributes
-
+ BlackBoxDescriptor::Pointer _desc;
//Private Methods
protected:
//Protected methods
-
+
};
//=========================================================================
+ void GObjectModel::updateBlackBox(BlackBoxDescriptor::Pointer descriptor)//virtual
+ {
+ }
+
+ //=========================================================================
} // EO namespace bbtk
// EOF
//Includes std
#include <iostream>
+#include <bbtkBlackBoxDescriptor.h>
+
namespace bbtk
{
void setState(int state);
int getState();
virtual bool isPointInside(double x,double y, double z);
+ virtual void updateBlackBox(BlackBoxDescriptor::Pointer descriptor);
private:
configureBaseView();
+ /* JUST TO TEST
vtkConeSource *cone = vtkConeSource::New();
cone->SetResolution(10);
getRenderer()->AddActor(_pointVtkActor);
-
+ */
/////////////////////
void wxVtkSceneManager::configureBaseView()
{
- vtkInteractorStyleImage *temp = vtkInteractorStyleImage::New();
- _baseView->GetWxVTKRenderWindowInteractor()->SetInteractorStyle(temp);
+ vtkInteractorStyleImage *style = vtkInteractorStyleImage::New();
+ _baseView->GetWxVTKRenderWindowInteractor()->SetInteractorStyle(style);
//_baseView->GetRenderer()->SetActiveCamera(_baseView->GetCamera());
//_baseView->GetRenderer()->ResetCamera ();
//_baseView->GetCamera()->SetParallelProjection(true);
- _baseView->GetRenderer()->SetBackground(1,1,1);
+ _baseView->GetRenderer()->SetBackground(0.9,0.9,0.9);
+ _baseView->GetRenderer()->GradientBackgroundOff();
_baseView->Refresh();
}
vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type);
GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
+ BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxName);
+
//Prepares the initial model
- cout<<"RaC Size:"<<_baseView->GetRenWin()->GetSize()[1]<<endl;
double xx = x;
double yy = _baseView->GetRenWin()->GetSize()[1]-y;
double zz = 0;
-
_baseView->TransCoordScreenToWorld(xx,yy,zz);
+ model->setInicPoint(xx,yy,zz);
+ model->updateBlackBox(descriptor);
+
//Associates the view with the correspondent renderer and the model.
//(NOTE: Refresh is only made by the view)
- model->setInicPoint(xx,yy,zz);
view->setModel(model);
view->setBaseView(_baseView);
view->initVtkObjects();
- //Refresh renderwindow with new objects
- refreshRenderWindow();
-
//Associates the controller with the correspondent model and view
controller->setModelAndView(model,view);
+
+ //Refresh renderwindow with new objects
+ refreshRenderWindow();
registerController((InteractorStyleMaracas*) controller);
+
}
//=========================================================================
void wxVtkSceneManager::registerController(InteractorStyleMaracas *param)
{
- cout<<"RaC wxVtkSceneManager::registerController param:"<<param<<endl;
vtkInteractorStyleBaseView* baseViewControlManager = (vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView();
baseViewControlManager->AddInteractorStyleMaracas( param );
}
bool wxVtkSceneManager::OnMouseMove()
{
- cout<<"RaC wxVtkSceneManager::OnMouseMove "<<endl;
+ //cout<<"RaC wxVtkSceneManager::OnMouseMove "<<endl;
return true;
}
//=========================================================================
{
if(_view->isPointInside(X,Y))
{
- _model->setState(HIGHLIGHTED);
+ _model->setState(HIGHLIGHTED);
+ }
+ }
+ if(state==HIGHLIGHTED)
+ {
+ if(!_view->isPointInside(X,Y))
+ {
+ _model->setState(NOTHING_HAPPENS);
}
}
GObjectsMVCFactory* GObjectsMVCFactory:: instance = NULL;
GObjectsMVCFactory::GObjectsMVCFactory()
- {
-
+ {
+ _interpreter =Interpreter::New();
+ _interpreter->SetCommandLine(true);
+ std::stringstream* buf = new std::stringstream;
+ *buf << "exec freeze_no_error" << std::endl;
+ *buf << "message max 0" << std::endl;
+ *buf << "include *" << std::endl;
+ _interpreter->InterpretBuffer(buf);
}
//=========================================================================
}
//=========================================================================
+ BlackBoxDescriptor::Pointer GObjectsMVCFactory::getBlackBoxDescriptor(std::string packageName, std::string boxName)
+ {
+ Factory::Pointer factory = _interpreter->GetExecuter()->GetFactory();
+ Package::Pointer k = factory->GetPackage(packageName);
+ std::map< std::string, BlackBoxDescriptor::Pointer> mapDesc = k->GetDescriptorMap();
+ return mapDesc[boxName];
+ }
+ //=========================================================================
GObjectsMVCFactory* GObjectsMVCFactory :: getInstance()
{
if(instance == NULL){
//Includes std
#include <iostream>
+
+#include <bbtkInterpreter.h>
+#include <bbtkFactory.h>
+#include <bbtkPackage.h>
+
namespace bbtk
{
//Public methods
static GObjectsMVCFactory* getInstance();
static void destroyInstance();
+ BlackBoxDescriptor::Pointer getBlackBoxDescriptor(std::string packageName, std::string boxName);
vtkGObjectView* createGObjectView(int type);
GObjectController* createGObjectController(int type);
GObjectModel* createGObjectModel(int type);
+ Interpreter::Pointer _interpreter;
+
private:
//Attributes
static GObjectsMVCFactory* instance;
+
//Private Methods
void vtkGBlackBoxView::refresh()
{
//paint();
+ if(_model->getState()==HIGHLIGHTED)
+ {
+ _objectActor->GetProperty()->SetColor(0.0,0.2,0.5);
+ }
+ else
+ {
+ _objectActor->GetProperty()->SetColor(0.3,0.2,0.2);
+ }
+ _baseView->GetRenderer()->Render();
}
//=========================================================================
_bboxMapper->SetInput(_pd);
_objectActor->SetMapper(_bboxMapper);
+ _objectActor->GetProperty()->SetColor(0.3,0.2,0.2);
+
}
//=========================================================================
{
_objectActor->GetProperty()->SetColor(1,0,0);
}
-
+ _baseView->GetRenderer()->Render();
//paint();
}
break;
case 15 :
BlackBoxDescriptor* desc = _pkgBrowser->GetActualSelected();
- cout<<"RaC GetActualSelected desc:"<<desc->GetAuthor()<<endl;
-
+
}
}
{
std::string packageName="";
std::string boxName="";
+
+
+ wxString foo( wxT(data) );
+ char str[150];
+ strcpy( str, (const char*)foo.mb_str(wxConvUTF8) );
+
+ char delims[] = ":";
+ char *result = NULL;
+ result = strtok( str, delims );
+ packageName += result;
+
+ result = strtok( NULL, delims );
+ boxName += result;
+
_sceneManager->createGBlackBox(x,y,packageName, boxName);
- cout<<"RaC DyD:"<<data<<" x:"<<x<<" y:"<<y<<endl;
+
+ //cout<<"result is pkg:"<<packageName<<" box:"<<boxName<<endl;
+ //cout<<"RaC DyD:"<<data<<" x:"<<x<<" t:"<<y<<endl;
return true;
}