示例#1
0
void testApp::guisetup()
{
    float dim = 20;
	float xInit = OFX_UI_GLOBAL_WIDGET_SPACING;
	float length = 200 - xInit;
	gui = new ofxUICanvas(0, 0, length + xInit * 2, 2560);
	gui->setFont("/System/Library/Fonts/Geneva.dfont");
	ofColor cb(64, 192),
	co(192, 192),
	coh(128, 192),
	cf(240, 255),
	cfh(128, 255),
	cp(96, 192),
	cpo(255, 192);
	gui->setUIColors(cb, co, coh, cf, cfh, cp, cpo);
	   
    gui->addLabel("Sensor", OFX_UI_FONT_LARGE);
    gui->addSlider("Zoom", 0.01, 1.0, &scale, length, dim);
    gui->add2DPad("Shift", ofPoint(-1.0,1.0), ofPoint(-1.0,1.0), &shift, length, length);
    gui->addSlider("Sensor Angle", 0, 360, &sensor_angle, length, dim);

    gui->addLabel("Region", OFX_UI_FONT_LARGE);
	gui->addLabelButton("Register", &register_region, length, dim);
    gui->addLabelButton("Clear", &clear_region, length, dim);
    
    gui->addLabel("Visualization");
    gui->addLabelToggle("Data", &draw_data, length, dim);

}
示例#2
0
/*--------------------------------------------------------------------------*/
IsotimeEpoch _isotime2epoch(const char * isotime_s) 
{ char osign_c;
  long osign;
  long year=0, month=0, day=0, hh=0, mm=0, ss=0;
  long Hh=0, Mm=0, Ss=0;
  double uuuuuu=0.0;
  char trimmed[TRIMLEN], *pd, *pt, *pf, *po, *pr;
  char datbuf[DLEN];
  char timbuf[TLEN];
  char frabuf[FLEN];
  char offbuf[OLEN];
  IsotimeEpoch epoch;

  if (ISOTIME_debug>0) fprintf(stderr,"_isotime2epoch >>%s<< BEGIN\n",
    isotime_s);

  // trim isotime_s, convert to uppercase and copy to trimmed
  pd = trim( trimmed, TRIMLEN, isotime_s );
  if (ISOTIME_debug>1) fprintf(stderr," trim returns >>%s<<\n",pd);

  // copy date
  pt = cpd( datbuf, DLEN, pd );
  if (ISOTIME_debug>1) fprintf(stderr," date >>%s<<\n",datbuf);

  // copy time
  pf = cpt( timbuf, TLEN, pt );
  if (ISOTIME_debug>1) fprintf(stderr," time >>%s<<\n",timbuf);

  // copy fraction
  po = cpf( frabuf, FLEN, pf );
  if (ISOTIME_debug>1) fprintf(stderr," fraction >>%s<<\n",frabuf);

  // copy offset
  pr = cpo( offbuf, OLEN, po );
  if (ISOTIME_debug>1) fprintf(stderr," offset >>%s<<\n",offbuf);
  
  sscanf(datbuf,"%4ld%2ld%2ld",&year,&month,&day);
  sscanf(timbuf,"%2ld%2ld%2ld",&hh,&mm,&ss);
  sscanf(frabuf,"%lf",&uuuuuu);
  sscanf(offbuf,"%c%2ld%2ld%2ld",&osign_c,&Hh, &Mm, &Ss);

  if ( strlen(pr)||(day==0) ) month=0; // error, if rest is not empty or day 0

  osign = (osign_c=='-')?-1:+1;
  epoch =  _convert2epoch(year,month,day,hh,mm,ss,uuuuuu,osign,Hh,Mm,Ss);

  if ( epoch.status ) {
    fprintf( stderr, "ERROR: Cannot read time \"%s\"\n",trimmed );
    fprintf( stderr, "       Format: YYYY-MM-DDThh:mm:ss[.uuuuuu][+Hh:Mm]\n" );
  }

  if (ISOTIME_debug>0) fprintf(stderr,"_isotime2epoch >>%s<< END\n",
    isotime_s);

  return( epoch );

} // _isotime2epoch
示例#3
0
void testApp::setup() {
	ofSetVerticalSync(true);
    ofEnableSmoothing();
	
	int n = ofxKinect::numAvailableDevices();    
	while(sensors.size() < n) {
		sensors.push_back(ofPtr<CircleSensor>(new CircleSensor()));
		sensors.back()->setup();
	}
    ofSort(sensors, bySerial);
    
    ofxXmlSettings xml;
    xml.loadFile("settings.xml");
	
	float dim = 20;
	float xInit = OFX_UI_GLOBAL_WIDGET_SPACING; 
	float length = 320 - xInit;
	gui = new ofxUICanvas(0, 0, length + xInit * 2, 2560);
	gui->setFont("/System/Library/Fonts/Geneva.dfont");
	ofColor cb(64, 192),
	co(192, 192),
	coh(128, 192),
	cf(240, 255),
	cfh(128, 255),
	cp(96, 192),
	cpo(255, 192);
	gui->setUIColors(cb, co, coh, cf, cfh, cp, cpo);
	
    gui->addLabel("Kinects: " +  ofToString(ofxKinect::numConnectedDevices()) + " / " + ofToString(ofxKinect::numTotalDevices()), OFX_UI_FONT_SMALL);
    
	gui->addLabel("Background", OFX_UI_FONT_LARGE);
	gui->addLabelToggle("Debug", &showDebug, length, dim);
	gui->addLabelButton("Set dead zones", &setDeadZones, length, dim);
	gui->addLabelButton("Clear", &backgroundClear, length, dim);
	gui->addLabelToggle("Calibrate", &backgroundCalibrate, length, dim);
	gui->addSlider("Threshold", 0, 255, &backgroundThreshold, length, dim);
	
	gui->addLabel("Tracking", OFX_UI_FONT_LARGE);
	gui->addSlider("Blur radius", 0, 11, &blurRadius, length, dim);
	gui->addSlider("Threshold", 0, 255, &circleThreshold, length, dim);
	gui->addSlider("Min radius", 0, 12, &minRadius, length, dim);
	gui->addSlider("Max radius", 0, 12, &maxRadius, length, dim);
	gui->addSlider("Sample radius", 0, 24, &sampleRadius, length, dim);
	
	gui->addLabel("Registration", OFX_UI_FONT_LARGE);
	gui->addLabelButton("Clear", &registrationClear, length, dim);
	gui->addLabelToggle("Calibrate", &registrationCalibrate, length, dim);
	gui->addSlider("Calibration accuracy", 100, 10000, &registrationCalibrationAccuracy, length, dim);
    
    gui->addLabel("Filtering", OFX_UI_FONT_LARGE);
	gui->addSlider("Max velocity", 0, 10000, &maxVelocity, length, dim);  
	gui->addSlider("Filter rate", 0, 1, &filterRate, length, dim);
}
示例#4
0
/***********************************************************
store object copy
***********************************************************/
void OsgObjectHandler::StoreObjectCopy()
{
	osg::CopyOp cpo(osg::CopyOp::DEEP_COPY_ALL);

	if(_OsgObject)
		_ObjectCopy = (osg::MatrixTransform*)_OsgObject->clone(cpo);
	else if(_OsgObjectNoLight)
		_ObjectCopy = (osg::MatrixTransform*)_OsgObjectNoLight->clone(cpo);

	if(_ObjectCopy)
	{
		osg::StateSet* stateset = _ObjectCopy->getOrCreateStateSet();
		stateset->removeAttribute(osg::StateAttribute::MATERIAL);

		//stateset->setMode(GL_COLOR_MATERIAL, osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); 
		stateset->setRenderingHint( osg::StateSet::DEFAULT_BIN );
	}
}
示例#5
0
/*+++------------------------------------------------------------------------
NAME
  addoffset2epoch --- Relative change of the time zone 

SYNOPSIS

  IsotimeEpoch addoffset2epoch( IsotimeEpoch epoch, const char * offset_s );

DESCRIPTION

  Changing the time zone relatively by incrementing the offset 
  and decrementing epoch.

RETURN VALUE

  updated epoch

----------------------------------------------------------------------------*/
IsotimeEpoch addoffset2epoch( IsotimeEpoch epoch, const char * offset_s )
{ char osign_c;
  char trimmed[TRIMLEN], *po, *pr;
  char offbuf[OLEN];
  long offset=0, Hh=0, Mm=0, Ss=0;

  if (ISOTIME_debug>0) 
    fprintf(stderr,"addoffset2epoch >>%s<< BEGIN\n",offset_s);

  if ( epoch.status ) goto offerr;

  // trim offset_s, convert to uppercase and copy to trimmed
  po = trim( trimmed, TRIMLEN, offset_s );
  if (ISOTIME_debug>1) fprintf(stderr," trim returns >>%s<<\n",po);

  // copy offset
  pr = cpo( offbuf, OLEN, po );
  if (ISOTIME_debug>1) fprintf(stderr," offset >>%s<<\n",offbuf);
 
  if ( strlen(pr) ) { 
    epoch.status=-1; 
    fprintf( stderr, "ERROR: Cannot read offset \"%s\"\n",trimmed );
    fprintf( stderr, "       Format: +HhMm | -HhMm, e.g. \"+0200\"\n" );
    goto offerr; 
  }

  if ( !epoch.status ) { 
    sscanf(offbuf,"%c%2ld%2ld%2ld",&osign_c,&Hh, &Mm, &Ss);
    offset = (Hh*60+Mm)*60+Ss;
    if (osign_c=='-') offset*=-1;
    epoch.offset += offset;
    epoch.sec    -= offset;
  }

  if (ISOTIME_debug>0) fprintf(stderr,"addoffset2epoch END\n");

  return ( epoch );

offerr: if (ISOTIME_debug>0) fprintf(stderr,"addoffset2epoch END\n");
        return ( epoch );

} // addoffset2epoch