本文整理汇总了C++中gem::Properties::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Properties::get方法的具体用法?C++ Properties::get怎么用?C++ Properties::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gem::Properties
的用法示例。
在下文中一共展示了Properties::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setProperties
void imageBase :: setProperties(gem::Properties&props) {
// nada
m_properties=props;
#if 0
std::vector<std::string> keys=props.keys();
int i=0;
for(i=0; i<keys.size(); i++) {
enum gem::Properties::PropertyType typ=props.type(keys[i]);
std::cerr << "key["<<keys[i]<<"]: "<<typ<<" :: ";
switch(typ) {
case (gem::Properties::NONE):
props.erase(keys[i]);
break;
case (gem::Properties::DOUBLE):
std::cerr << gem::any_cast<double>(props.get(keys[i]));
break;
case (gem::Properties::STRING):
std::cerr << "'" << gem::any_cast<std::string>(props.get(keys[i])) << "'";
break;
default:
std::cerr << "<unknown:" << props.get(keys[i]).get_type().name() << ">";
break;
}
}
std::cerr << std::endl;
#endif
}
示例2: setProperties
void videoVLC::setProperties(gem::Properties&props)
{
int width=-1;
int height=-1;
m_props=props;
double d;
if(props.get("width", d)) {
if(d>0) {
width = d;
}
}
if(props.get("height", d)) {
if(d>0) {
height=d;
}
}
if(!m_mediaplayer) {
if(width>0) {
m_pixBlock.image.xsize=width;
}
if(height>0) {
m_pixBlock.image.ysize=height;
}
} else {
// changes will take effect with next restart
}
}
示例3: setParameters
void setParameters(gem::Properties&parms) {
unsigned int i=0;
for(i=0; i<m_parameterNames.size(); i++) {
std::string key=m_parameterNames[i];
std::string s1, s2;
double d1, d2;
switch(m_parameter.type(key)) {
case gem::Properties::NONE:
if(gem::Properties::NONE==parms.type(key)) {
parms.erase(key);
setParameter(i);
}
break;
case gem::Properties::DOUBLE:
if(m_parameter.get(key, d1) && parms.get(key, d2)) {
if(d1!=d2) {
m_parameter.set(key, d2);
setParameter(i, d2);
}
}
break;
case gem::Properties::STRING:
if(m_parameter.get(key, s1) && parms.get(key, s2)) {
if(s1!=s2) {
m_parameter.set(key, s2);
setParameter(i, s2);
}
}
break;
default: break;
}
}
}
示例4: setProperties
void modelASSIMP3 :: setProperties(gem::Properties&props) {
double d;
#if 0
std::vector<std::string>keys=props.keys();
unsigned int i;
for(i=0; i<keys.size(); i++) {
post("key[%d]=%s ... %d", i, keys[i].c_str(), props.type(keys[i]));
}
#endif
std::string s;
if(props.get("textype", s)) {
// if there are NO texcoords, we only accept 'linear' and 'spheremap'
// else, we also allow 'UV'
// not-accepted textype, simply use the last one
if(m_have_texcoords && "UV" == s)
m_textype = "";
else
if(("linear" == s) || ("spheremap" == s))
m_textype = s;
m_rebuild = true;
}
if(props.get("rescale", d)) {
bool b=(bool)d;
if(b) {
float tmp;
tmp = m_max.x-m_min.x;
tmp = aisgl_max(m_max.y - m_min.y,tmp);
tmp = aisgl_max(m_max.z - m_min.z,tmp);
m_scale = 2.f / tmp;
m_offset.x=-m_center.x;
m_offset.y=-m_center.y;
m_offset.z=-m_center.z;
} else {
// FIXXME shouldn't this be the default???
m_scale=1.;
m_offset.x=m_offset.y=m_offset.z=0.f;
}
}
if(props.get("usematerials", d)) {
bool useMaterial=d;
if(useMaterial!=m_useMaterial)
m_rebuild=true;
m_useMaterial=useMaterial;
}
render();
}
示例5:
void filmQT4L::setProperties(gem::Properties&props)
{
double d;
if(props.get("colorspace", d)) {
m_wantedFormat=d;
}
}
示例6: open
/////////////////////////////////////////////////////////
// really open the file ! (OS dependent)
//
/////////////////////////////////////////////////////////
bool filmQT4L :: open(const std::string&filename,
const gem::Properties&wantProps)
{
int wantedFormat=GEM_RGBA;
double d;
unsigned int format=0;
if(wantProps.get("format", d)) {
format=d;
}
switch(format) {
default:
break;
case GEM_RGBA:
case GEM_YUV:
case GEM_GRAY:
m_wantedFormat=format;
break;
}
char*cfilename=const_cast<char*>(filename.c_str());
if (quicktime_check_sig(cfilename)) { /* ok, this is quicktime */
if (!(m_quickfile = quicktime_open(filename.c_str(), 1, 0))) {
verbose(0, "[GEM:filmQT4L] Unable to open file: %s", filename.c_str());
return false;
}
m_curFrame = -1;
// Get the number of tracks
m_numTracks = quicktime_video_tracks(m_quickfile);
// Get the length of the movie (on track current track)
m_numFrames = quicktime_video_length(m_quickfile, m_curTrack);
// Get the frame-rate
m_fps = quicktime_frame_rate(m_quickfile, m_curTrack);
// Get the video dimensions
m_image.image.xsize = quicktime_video_width (m_quickfile, m_curTrack);
m_image.image.ysize = quicktime_video_height(m_quickfile, m_curTrack);
if (!quicktime_supported_video(m_quickfile, m_curTrack)) {
char *codec = quicktime_video_compressor(m_quickfile, m_curTrack);
verbose(0, "[GEM:filmQT4L] unsupported CODEC '%s'!", codec);
quicktime_close(m_quickfile);
m_quickfile=0;
return false;
}
m_image.image.setCsizeByFormat(wantedFormat);
m_image.image.reallocate();
m_qtimage.xsize=m_image.image.xsize;
m_qtimage.ysize=m_image.image.ysize;
m_qtimage.setCsizeByFormat(GEM_RGB);
m_qtimage.reallocate();
m_newfilm = true;
return true;
}
goto unsupported;
unsupported:
close();
return false;
}
示例7: setProperties
void videoVFW :: setProperties(gem::Properties&props) {
double d;
bool dorestart=false;
if (props.get("width", d)) {
m_width=d;
dorestart=true;
}
if (props.get("height", d)) {
m_height=d;
dorestart=true;
}
if(dorestart && m_hWndC)
reset();
}
示例8: save
bool imageMAGICK::save(const imageStruct&image, const std::string&filename, const std::string&mimetype, const gem::Properties&props) {
imageStruct*img=const_cast<imageStruct*>(&image);
imageStruct*pImage=img;
std::string cs;
switch(img->format) {
case GL_LUMINANCE:
cs="K";
break;
case GL_RGBA:
cs="RGBA";
break;
default:
pImage=new imageStruct();
pImage->convertFrom(img, GL_RGB);
case GL_RGB:
cs="RGB";
break;
case GL_BGRA_EXT:
cs="BGRA";
break;
}
try{
Magick::Image mimage(pImage->xsize, pImage->ysize, cs, Magick::CharPixel, pImage->data);
// since openGL is upside down
if(!pImage->upsidedown) {
mimage.flip();
}
// 8 bits per channel are enough!
// LATER make this dependent on the image->type
mimage.depth(8);
double quality;
if(props.get("quality", quality)) {
mimage.quality(quality);
}
try {
// finally convert and export
mimage.write(filename);
} catch (Magick::Warning e) {
verbose(1, "magick saving problem: %s", e.what());
}
} catch (Magick::Exception e){
error("%s", e.what());
if(pImage!=&image)delete pImage; pImage=NULL;
return false;
} catch (...) {
error("imageMAGICK:: uncaught exception!");
return false;
}
if(pImage!=&image)delete pImage; pImage=NULL;
return true;
}
示例9: setProperties
void videoTEST::setProperties(gem::Properties&props) {
m_props=props;
double d;
if(props.get("width", d)) {
if(d>0)
m_pixBlock.image.xsize = d;
}
if(props.get("height", d)) {
if(d>0)
m_pixBlock.image.ysize = d;
}
std::string s;
if(props.get("type", s)) {
if("noise"==s)
m_type=0;
else if("red"==s)
m_type=1;
else if("green"==s)
m_type=2;
else if("blue"==s)
m_type=3;
}
}
示例10: open
/////////////////////////////////////////////////////////
// really open the file ! (OS dependent)
//
/////////////////////////////////////////////////////////
bool filmMPEG3 :: open(const std::string filename, const gem::Properties&wantProps)
{
char*cfilename=const_cast<char*>(filename.c_str());
if (mpeg3_check_sig(cfilename)){/* ok, this is mpeg(3) */
#ifdef FILMMPEG3_OPEN17
// new API with more sophisticated error-feedback
mpeg_file= mpeg3_open(cfilename, 0);
#else
// old API
mpeg_file= mpeg3_open(cfilename);
#endif
if(!mpeg_file) {
//error("filmMPEG3: this file %s does not seem to hold any video data", filename.c_str());
goto unsupported;
}
if (!mpeg3_has_video(mpeg_file)){
error("filmMPEG3: this file %s does not seem to hold any video data", filename.c_str());
goto unsupported;
}
m_numTracks = mpeg3_total_vstreams(mpeg_file);
if(m_curTrack>=m_numTracks || m_curTrack<0)
m_curTrack=0;
m_numFrames = mpeg3_video_frames(mpeg_file, m_curTrack);
m_fps = mpeg3_frame_rate(mpeg_file, m_curTrack);
m_image.image.xsize=mpeg3_video_width(mpeg_file, m_curTrack);
m_image.image.ysize=mpeg3_video_height(mpeg_file, m_curTrack);
if (!m_image.image.xsize*m_image.image.ysize)goto unsupported;
double d;
if(wantProps.get("colorspace", d)) {
m_image.image.setCsizeByFormat((int)d);
m_wantedFormat=m_image.image.format;
}
m_image.image.reallocate();
changeImage(0,-1);
m_newfilm=true;
return true;
}
goto unsupported;
unsupported:
close();
return false;
}
示例11: open
/////////////////////////////////////////////////////////
// open the file
//
/////////////////////////////////////////////////////////
bool filmAVIPLAY :: open(const std::string filename, const gem::Properties&wantProps)
{
double d;
if(wantProps.get("colorspace", d) && d>0) {
m_wantedFormat=d;
}
// how do we close the avifile ??? automagically ?
if (!(m_avifile = CreateIAviReadFile(filename.c_str())))goto unsupported;
while(!(*m_avifile).IsOpened()) {
struct timeval sleep;
sleep.tv_sec=0;
sleep.tv_usec=500;/*500us*/
select(0,0,0,0,&sleep);
}
if (!(*m_avifile).IsValid())goto unsupported;
m_numTracks = (*m_avifile).VideoStreamCount();
if (m_numTracks<1)return false;
if (m_curTrack>=m_numTracks)m_curTrack = 0;
try {
m_avistream=(*m_avifile).GetStream(m_curTrack, avm::IStream::StreamType(1));
} catch (const char* string) {
m_avistream = 0;
}
if (!m_avistream)goto unsupported;
if ((*m_avistream).StartStreaming()==-1)goto unsupported;
m_numFrames = (*m_avistream).GetLength();
m_curFrame = -1;
if (1) {
avm::StreamInfo *l_info = (*m_avistream).GetStreamInfo();
m_image.image.xsize = (*l_info).GetVideoWidth();
m_image.image.ysize = (*l_info).GetVideoHeight();
m_fps= (*l_info).GetFps();
}
m_image.image.setCsizeByFormat(m_wantedFormat);
if (!(m_image.image.xsize*m_image.image.ysize*m_image.image.csize))goto unsupported;
m_readNext=true;
m_newfilm = true;
return true;
goto unsupported;
unsupported:
close();
return false;
}
示例12: open
virtual bool open(const std::string&name, const gem::Properties&requestprops) {
if(m_handle)close();
std::vector<std::string> backends;
if(requestprops.type("backends")!=gem::Properties::UNSET) {
requestprops.get("backends", backends);
}
// requestprops.erase("backends");
bool tried=false;
if(!backends.empty()) {
unsigned int i, j;
for(j=0; !m_handle && j<backends.size(); j++) {
std::string id=backends[j];
for(i=0; i<m_handles.size(); i++) {
/* coverity[assign_where_compare_meant] we set 'tried' to true if we have found at least one matching backend */
if(id==m_ids[i]&& (tried=true) && m_handles[i]->open(name, requestprops)) {
m_handle=m_handles[i];
}
}
}
}
if(!m_handle && !tried) {
if(!backends.empty() && !m_handles.empty()) {
verbose(2, "no available loader selected, falling back to valid ones");
}
unsigned int i=0;
for(i=0; i<m_handles.size(); i++) {
if(m_handles[i] && m_handles[i]->open(name, requestprops)) {
m_handle=m_handles[i];
break;
} else {
}
}
}
return (NULL!=m_handle);
}
示例13: setProperties
void videoDECKLINK::setProperties(gem::Properties&props)
{
std::vector<std::string>keys=props.keys();
int i=0;
for(i=0; i<keys.size(); i++) {
const std::string key =keys[i];
if("format" == key) {
std::string s;
double d;
switch(props.type(key)) {
case gem::Properties::STRING:
if(props.get(key, s)) {
m_formatnum =-1;
m_formatname=s;
}
break;
case gem::Properties::DOUBLE:
if(props.get(key, d)) {
m_formatnum =(int)d;
m_formatname="";
}
break;
}
}
if("connection" == key) {
BMDVideoConnection vconn = m_connectionType;
std::string s;
double d;
switch(props.type(key)) {
case gem::Properties::STRING:
if(props.get(key, s)) {
if ("SDI" == s) {
vconn=bmdVideoConnectionSDI;
} else if ("HDMI" == s) {
vconn=bmdVideoConnectionHDMI;
} else if ("OpticalSDI" == s) {
vconn=bmdVideoConnectionOpticalSDI;
} else if ("Component" == s) {
vconn=bmdVideoConnectionComponent;
} else if ("Composite" == s) {
vconn=bmdVideoConnectionComposite;
} else if ("SVideo" == s) {
vconn=bmdVideoConnectionSVideo;
}
}
break;
case gem::Properties::DOUBLE:
if(props.get(key, d)) {
int idx =(int)d;
switch(idx) {
default:
case 0:
vconn=bmdVideoConnectionSDI;
break;
case 1:
vconn=bmdVideoConnectionHDMI;
break;
case 2:
vconn=bmdVideoConnectionOpticalSDI;
break;
case 3:
vconn=bmdVideoConnectionComponent;
break;
case 4:
vconn=bmdVideoConnectionComposite;
break;
case 5:
vconn=bmdVideoConnectionSVideo;
break;
}
}
break;
}
if(m_dlConfig && (m_connectionType != vconn)) {
m_dlConfig->SetInt(bmdDeckLinkConfigVideoInputConnection, vconn);
}
m_connectionType = vconn;
}
}
m_props=props;
}
示例14: save
bool imageTIFF::save(const imageStruct&constimage, const std::string&filename, const std::string&mimetype, const gem::Properties&props) {
TIFF *tif = NULL;
if(GL_YUV422_GEM==constimage.format) {
error("don't know how to write YUV-images with libTIFF");
return false;
}
tif=TIFFOpen(filename.c_str(), "w");
if (tif == NULL) {
return false;
}
imageStruct image; constimage.copy2Image(&image);
image.fixUpDown();
uint32 width=image.xsize, height = image.ysize;
short bits=8, samps=image.csize;
int npixels = width * height;
//int planar_conf = PLANARCONFIG_CONTIG;
std::string software = "PD/GEM";
std::string artist;
std::string hostcomputer;
double xresolution = 72., yresolution=72.;
short resunit = RESUNIT_INCH;
props.get("xresolution", xresolution);
props.get("yresolution", yresolution);
std::string resunit_s;
if(props.get("resolutionunit", resunit_s)) {
if(("inch"==resunit_s) || ("english"==resunit_s) || ("imperial"==resunit_s))
resunit=RESUNIT_INCH;
else if(("centimeter"==resunit_s) || ("metric"==resunit_s))
resunit=RESUNIT_CENTIMETER;
else
resunit=RESUNIT_NONE;
}
props.get("software", software);
props.get("artist", artist);
props.get("hostcomputer", hostcomputer);
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height);
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bits);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, samps);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, 1);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
TIFFSetField(tif, TIFFTAG_XRESOLUTION, xresolution); // RATIONAL
TIFFSetField(tif, TIFFTAG_YRESOLUTION, yresolution); // RATIONAL
TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, resunit);
if(!software.empty())
TIFFSetField(tif, TIFFTAG_SOFTWARE, software.c_str());
if(!artist.empty())
TIFFSetField(tif, TIFFTAG_ARTIST, artist.c_str());
if(!hostcomputer.empty())
TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, hostcomputer.c_str());
int yStride = image.xsize * image.csize;
unsigned char *srcLine = &(image.data[npixels * image.csize]);
srcLine -= yStride;
for (uint32 row = 0; row < height; row++) {
unsigned char *buf = srcLine;
if (TIFFWriteScanline(tif, buf, row, 0) < 0)
{
error("GEM: could not write line %d to image %s", row, filename.c_str());
TIFFClose(tif);
delete [] buf;
return(false);
}
srcLine -= yStride;
}
TIFFClose(tif);
return true;
}
示例15: open
bool videoVLC::open(gem::Properties&props)
{
if(m_mediaplayer) {
close();
}
m_pixBlock.image.xsize=0;
m_pixBlock.image.ysize=0;
setProperties(props);
if(m_devname.empty()) {
return false;
}
libvlc_media_t*media = libvlc_media_new_location (m_instance,
m_devname.c_str());
if(!media) {
media = libvlc_media_new_path (m_instance, m_devname.c_str());
}
if(!media) {
return false;
}
char buf[MAXVLCSTRING];
libvlc_media_add_option(media,":noaudio");
libvlc_media_add_option(media,":no-video-title-show");
int w=m_pixBlock.image.xsize;
int h=m_pixBlock.image.ysize;
std::vector<std::string>keys=props.keys();
unsigned int i;
for(i=0; i<keys.size(); i++) {
std::string key=keys[i];
double d;
std::string s;
buf[0]=0;
if(0) {}
else if("width"==key) {
if(props.get(key, d)&&(d>0)) {
w=d;
}
} else if("height"==key) {
if(props.get(key, d)&&(d>0)) {
h=d;
}
} else {
gem::Properties::PropertyType type = props.type(key);
switch(type) {
case gem::Properties::NONE:
snprintf(buf, MAXVLCSTRING, ":%s", key.c_str());
break;
case gem::Properties::DOUBLE:
if(props.get(key, d)) {
snprintf(buf, MAXVLCSTRING, ":%s=%g", key.c_str(), d);
}
break;
case gem::Properties::STRING:
if(props.get(key, s)) {
/* need to find an option that actually takes strings, so i can test this with spaces */
snprintf(buf, MAXVLCSTRING, ":%s=%s", key.c_str(), s.c_str());
}
break;
default:
break;
}
if(0!=buf[0]) {
buf[MAXVLCSTRING-1]=0;
libvlc_media_add_option(media,buf);
}
}
}
resize(w,h,0);
m_pixBlock.image.setWhite();
m_mediaplayer=libvlc_media_player_new_from_media(media);
libvlc_media_release(media);
/* helper classes to register callbacks */
struct _callbackObj {
static void*lock(void*opaque, void**plane )
{
videoVLC*obj=(videoVLC*)opaque;
if(obj) {
return obj->lockFrame(plane);
}
return NULL;
}
static void unlock(void*opaque, void*picture, void*const*plane)
{
videoVLC*obj=(videoVLC*)opaque;
if(obj) {
obj->unlockFrame(picture, plane);
}
//.........这里部分代码省略.........