Exemplo n.º 1
0
void terrama2::services::view::core::DataManager::addJSon(const QJsonObject& obj)
{
  try
  {
    std::lock_guard<std::recursive_mutex> lock(mtx_);

    terrama2::core::DataManager::DataManager::addJSon(obj);

    auto view = obj["Views"].toArray();
    for(auto json : view)
    {
      auto dataPtr = terrama2::services::view::core::fromViewJson(json.toObject());
      if(hasView(dataPtr->id))
        update(dataPtr);
      else
        add(dataPtr);
    }
  }
  catch(const terrama2::Exception& /*e*/)
  {
    // loggend on throw...
  }
  catch(boost::exception& e)
  {
    TERRAMA2_LOG_ERROR() << boost::diagnostic_information(e);
  }
  catch(std::exception& e)
  {
    TERRAMA2_LOG_ERROR() << e.what();
  }
  catch(...)
  {
    TERRAMA2_LOG_ERROR() << QObject::tr("Unknown error...");
  }
}
Exemplo n.º 2
0
void ProxyViz::draw( M3dView & view, const MDagPath & path, 
							 M3dView::DisplayStyle style,
							 M3dView::DisplayStatus status )
{
	if(!m_enableCompute) return;
	MObject thisNode = thisMObject();
	updateWorldSpace(thisNode);
	
	MPlug mutxplug( thisNode, axmultiplier);
	MPlug mutyplug( thisNode, aymultiplier);
	MPlug mutzplug( thisNode, azmultiplier);
	setScaleMuliplier(mutxplug.asFloat(), 
						mutyplug.asFloat(),
						mutzplug.asFloat() );	
                        
    MPlug svtPlug(thisNode, adisplayVox);
    setShowVoxLodThresold(svtPlug.asFloat() );
	
	MDagPath cameraPath;
	view.getCamera(cameraPath);
	if(hasView() ) updateViewFrustum(thisNode);
	else updateViewFrustum(cameraPath);
	
	setViewportAspect(view.portWidth(), view.portHeight() );
	
	MPlug actp(thisNode, aactivated);
	if(actp.asBool()) setWireColor(.125f, .1925f, .1725f);
    else setWireColor(.0675f, .0675f, .0675f);

	_viewport = view;
	fHasView = 1;
	
	view.beginGL();
	
	double mm[16];
	matrix_as_array(_worldInverseSpace, mm);
	
	glPushMatrix();
	glMultMatrixd(mm);	
	
	ExampVox * defBox = plantExample(0);
	updateGeomBox(defBox, thisNode);
	drawWireBox(defBox->geomCenterV(), defBox->geomScale() );
	Matrix44F mat;
	mat.setFrontOrientation(Vector3F::YAxis);
	mat.scaleBy(defBox->geomSize() );
    mat.glMatrix(m_transBuf);
	
	drawCircle(m_transBuf);
	
	drawGridBounding();
	// drawGrid();

	if ( style == M3dView::kFlatShaded || 
		    style == M3dView::kGouraudShaded ) {		
		drawPlants();
	}
	else 
		drawWiredPlants();
	
    if(hasView() ) drawViewFrustum();
    
	drawBrush(view);
	drawActivePlants();
	drawGround();
	glPopMatrix();
	view.endGL();
	std::cout<<" viz node draw end";
}