示例#1
0
文件: global.cpp 项目: bohara/Collage
bool Global::fromString(const std::string& data )
{
    if( data.empty() || data[0] != SEPARATOR )
        return false;

    std::vector< uint32_t > newGlobals;
    newGlobals.reserve(IATTR_ALL);

    size_t startMarker( 1u );
    size_t endMarker( 1u );
    while( true )
    {
        startMarker = data.find( SEPARATOR, endMarker );
        if( startMarker == std::string::npos )
            break;

        endMarker = data.find( SEPARATOR, startMarker + 1 );
        if( endMarker == std::string::npos )
            break;

        const std::string sub = data.substr( startMarker + 1,
                                             endMarker - startMarker - 1 );
        if( !sub.empty() && isdigit( sub[0] ))
            newGlobals.push_back( atoi( sub.c_str( )) );
        else
            break;
    }

    // only apply a 'complete' global list
    if( newGlobals.size() != IATTR_ALL )
        return false;

    std::copy( newGlobals.begin(), newGlobals.end(), _iAttributes );
    return true;
}
示例#2
0
void QOpenCV::OpenCVWindow::onMarkerStartCancel( bool checked )
{
	if ( checked ) {
		mMarkerPB->setEnabled( false );
		mMarkerPB->setText( tr( "Stop Marker" ) );
		mMarkerBehindCB->setEnabled( true );
		mUpdateCorParPB->setEnabled( true );
		emit setCapVideoMarker( OpenCV::CamSelectCore::getInstance()->selectCamera() );
		emit startMarker();
		mMarkerPB->setEnabled( true );
		emit arucoRunning( true );

		if ( Util::ApplicationConfig::get()->getValue( "Viewer.SkyBox.Noise" ).toInt() >1 ) {
			mMarkerBackgrCB->setEnabled( true );
		}
	}
	else {
		mMarkerPB->setEnabled( false );
		mMarkerBehindCB->setEnabled( false );
		mCorEnabledCB->setEnabled( false );
		mUpdateCorParPB->setEnabled( false );
		mMarkerBackgrCB->setEnabled( false );
		emit stopMarker( true );
		emit arucoRunning( false );
	}
}
示例#3
0
void libcdr::CDRContentCollector::_lineProperties(librevenge::RVNGPropertyList &propList)
{
  if (m_currentLineStyle.lineType == (unsigned short)-1)
  {
    propList.insert("draw:stroke", "solid");
    propList.insert("svg:stroke-width", 0.0);
    propList.insert("svg:stroke-color", "#000000");
  }
  else
  {
    if (m_currentLineStyle.lineType & 0x1)
      propList.insert("draw:stroke", "none");
    else if (m_currentLineStyle.lineType & 0x6)
    {
      if (m_currentLineStyle.dashArray.size() && (m_currentLineStyle.lineType & 0x4))
        propList.insert("draw:stroke", "dash");
      else
        propList.insert("draw:stroke", "solid");
      double scale = 1.0;
      if (m_currentLineStyle.lineType & 0x20) // scale line with image
      {
        scale = m_currentTransforms.getScaleX();
        double scaleY = m_currentTransforms.getScaleY();
        if (scaleY > scale)
          scale = scaleY;
      }
      scale *= m_currentLineStyle.stretch;
      propList.insert("svg:stroke-width", m_currentLineStyle.lineWidth * scale);
      propList.insert("svg:stroke-color", m_ps.getRGBColorString(m_currentLineStyle.color));

      switch (m_currentLineStyle.capsType)
      {
      case 1:
        propList.insert("svg:stroke-linecap", "round");
        break;
      case 2:
        propList.insert("svg:stroke-linecap", "square");
        break;
      default:
        propList.insert("svg:stroke-linecap", "butt");
      }

      switch (m_currentLineStyle.joinType)
      {
      case 1:
        propList.insert("svg:stroke-linejoin", "round");
        break;
      case 2:
        propList.insert("svg:stroke-linejoin", "bevel");
        break;
      default:
        propList.insert("svg:stroke-linejoin", "miter");
      }

      if (m_currentLineStyle.dashArray.size())
      {
        int dots1 = 0;
        int dots2 = 0;
        unsigned dots1len = 0;
        unsigned dots2len = 0;
        unsigned gap = 0;

        if (m_currentLineStyle.dashArray.size() >= 2)
        {
          dots1len = m_currentLineStyle.dashArray[0];
          gap = m_currentLineStyle.dashArray[1];
        }

        unsigned long count = m_currentLineStyle.dashArray.size() / 2;
        unsigned i = 0;
        for (; i < count;)
        {
          if (dots1len == m_currentLineStyle.dashArray[2*i])
            dots1++;
          else
            break;
          gap = gap < m_currentLineStyle.dashArray[2*i+1] ?  m_currentLineStyle.dashArray[2*i+1] : gap;
          i++;
        }
        if (i < count)
        {
          dots2len = m_currentLineStyle.dashArray[2*i];
          gap = gap < m_currentLineStyle.dashArray[2*i+1] ? m_currentLineStyle.dashArray[2*i+1] : gap;
        }
        for (; i < count;)
        {
          if (dots2len == m_currentLineStyle.dashArray[2*i])
            dots2++;
          else
            break;
          gap = gap < m_currentLineStyle.dashArray[2*i+1] ? m_currentLineStyle.dashArray[2*i+1] : gap;
          i++;
        }
        if (!dots2)
        {
          dots2 = dots1;
          dots2len = dots1len;
        }
        propList.insert("draw:dots1", dots1);
        propList.insert("draw:dots1-length", 72.0*(m_currentLineStyle.lineWidth * scale)*dots1len, librevenge::RVNG_POINT);
        propList.insert("draw:dots2", dots2);
        propList.insert("draw:dots2-length", 72.0*(m_currentLineStyle.lineWidth * scale)*dots2len, librevenge::RVNG_POINT);
        propList.insert("draw:distance", 72.0*(m_currentLineStyle.lineWidth * scale)*gap, librevenge::RVNG_POINT);
      }
    }
    else
    {
      propList.insert("draw:stroke", "solid");
      propList.insert("svg:stroke-width", 0.0);
      propList.insert("svg:stroke-color", "#000000");
    }
  }

  // Deal with line markers (arrows, etc.)
  if (!m_currentLineStyle.startMarker.empty())
  {
    CDRPath startMarker(m_currentLineStyle.startMarker);
    startMarker.transform(m_currentTransforms);
    if (!m_groupTransforms.empty())
      startMarker.transform(m_groupTransforms.top());
    CDRTransform tmpTrafo = CDRTransform(1.0, 0.0, 0.0, 0.0, -1.0, 0);
    startMarker.transform(tmpTrafo);
    librevenge::RVNGString path, viewBox;
    double width;
    startMarker.writeOut(path, viewBox, width);
    propList.insert("draw:marker-start-viewbox", viewBox);
    propList.insert("draw:marker-start-path", path);
    // propList.insert("draw:marker-start-width", width);
  }
  if (!m_currentLineStyle.endMarker.empty())
  {
    CDRPath endMarker(m_currentLineStyle.endMarker);
    endMarker.transform(m_currentTransforms);
    if (!m_groupTransforms.empty())
      endMarker.transform(m_groupTransforms.top());
    CDRTransform tmpTrafo = CDRTransform(-1.0, 0.0, 0.0, 0.0, -1.0, 0);
    endMarker.transform(tmpTrafo);
    librevenge::RVNGString path, viewBox;
    double width;
    endMarker.writeOut(path, viewBox, width);
    propList.insert("draw:marker-end-viewbox", viewBox);
    propList.insert("draw:marker-end-path", path);
    // propList.insert("draw:marker-end-width", width);
  }



}
示例#4
0
void OpenCV::OpenCVCore::createConnectionAruco()
{
	// send actual image
	QObject::connect( mOpencvWindow,
					  SIGNAL( sendImgMarker( bool ) ),
					  mThrAruco,
					  SLOT( setSendImgEnabling( bool ) ) );
	/*QObject::connect( mThrAruco,
					  SIGNAL(pushImage(QImage)),
					  mOpencvDialog,
					  SLOT(setLabelQ(QImage)) );*/
	QObject::connect( mThrAruco,
					  SIGNAL( pushImagemMat( cv::Mat ) ),
					  mOpencvWindow,
					  SLOT( setLabel( cv::Mat ) ) );


	// send actual image to background
	QObject::connect( mOpencvWindow,
					  SIGNAL( sendBackgrImgMarker( bool ) ),
					  mThrAruco,
					  SLOT( setSendBackgrImgEnabled( bool ) ) );

	// start, stop
	QObject::connect( mOpencvWindow,
					  SIGNAL( startMarker() ),
					  mThrAruco,
					  SLOT( start() ) );
	QObject::connect( mOpencvWindow,
					  SIGNAL( stopMarker( bool ) ),
					  mThrAruco,
					  SLOT( setCancel( bool ) ) );
	QObject::connect( mThrAruco,
					  SIGNAL( finished() ),
					  mOpencvWindow,
					  SLOT( onMarkerThrFinished() ) );
	QObject::connect( mOpencvWindow,
					  SIGNAL( setCapVideoMarker( OpenCV::CapVideo* ) ),
					  mThrAruco,
					  SLOT( setCapVideo( OpenCV::CapVideo* ) ) );
	QObject::connect( mOpencvWindow,
					  SIGNAL( startMultiMarker() ),
					  mThrAruco,
					  SLOT( start() ) );
	QObject::connect( mOpencvWindow,
					  SIGNAL( stopMultiMarker( bool ) ),
					  mThrAruco,
					  SLOT( setCancel( bool ) ) );
	QObject::connect( mOpencvWindow,
					  SIGNAL( startMarker() ),
					  AppCore::Core::getInstance( mApp )->getCoreWindow(),
					  SLOT( swapManipulator() ) );
	QObject::connect( mOpencvWindow,
					  SIGNAL( arucoRunning( bool ) ),
					  AppCore::Core::getInstance( mApp )->getCoreGraph(),
					  SLOT( setArucoRunning( bool ) ) );

	// other seting
	QObject::connect( mOpencvWindow->getMarkerBehindCB(),
					  SIGNAL( clicked( bool ) ),
					  mThrAruco,
					  SLOT( setPositionOfMarker( bool ) ) );
	QObject::connect( mOpencvWindow->getCorEnabledCB(),
					  SIGNAL( clicked( bool ) ),
					  mThrAruco,
					  SLOT( setCorEnabling( bool ) ) );
	QObject::connect( mOpencvWindow->getUpdateCorParPB(),
					  SIGNAL( clicked() ),
					  mThrAruco,
					  SLOT( updateCorectionPar() ) );
	QObject::connect( mThrAruco,
					  SIGNAL( corParUpdated() ),
					  mOpencvWindow,
					  SLOT( onCorParUpdated() ) );
	QObject::connect( mOpencvWindow,
					  SIGNAL( setMultiMarker( bool ) ),
					  mThrAruco,
					  SLOT( setMultiMarker( bool ) ) );

	// aruco mouse Controll
	QObject::connect( mOpencvWindow->getInterchangeMarkersPB(),
					  SIGNAL( clicked() ),
					  mThrAruco,
					  SLOT( interchangeMarkers() ) );

}