本文整理汇总了C++中dest函数的典型用法代码示例。如果您正苦于以下问题:C++ dest函数的具体用法?C++ dest怎么用?C++ dest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dest函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dest
featureset_ptr Map::query_point(unsigned index, double x, double y) const
{
if ( index< layers_.size())
{
mapnik::layer const& layer = layers_[index];
try
{
double z = 0;
mapnik::projection dest(srs_);
mapnik::projection source(layer.srs());
proj_transform prj_trans(source,dest);
prj_trans.backward(x,y,z);
double minx = current_extent_.minx();
double miny = current_extent_.miny();
double maxx = current_extent_.maxx();
double maxy = current_extent_.maxy();
prj_trans.backward(minx,miny,z);
prj_trans.backward(maxx,maxy,z);
double tol = (maxx - minx) / width_ * 3;
mapnik::datasource_ptr ds = layer.datasource();
if (ds)
{
#ifdef MAPNIK_DEBUG
std::clog << " query at point tol = " << tol << " (" << x << "," << y << ")\n";
#endif
featureset_ptr fs = ds->features_at_point(mapnik::coord2d(x,y));
if (fs)
return boost::make_shared<filter_featureset<hit_test_filter> >(fs,
hit_test_filter(x,y,tol));
}
}
catch (...)
{
#ifdef MAPNIK_DEBUG
std::clog << "exception caught in \"query_point\"\n";
#endif
}
}
return featureset_ptr();
}
开发者ID:novldp,项目名称:mapnik,代码行数:42,代码来源:map.cpp
示例2: main
int main()
{
std::ifstream src1("src1");
if (!src1.is_open()) { // checking
std::cout << "Error in openning file " <<std::endl;
return -1;
}
std::ifstream src2("src2");
if (!src2.is_open()) { // checking
std::cout << "Error in openning file " <<std::endl;
return -1;
}
std::ofstream dest("dest");
if (!dest.is_open()) { // checking
std::cout << "Error in openning file " <<std::endl;
return -1;
}
std::string line_buf;
while (src1.good() || src2.good())
{
if (src1.good()) {
std::getline(src1, line_buf);
dest << line_buf << " ";
}
if (src2.good()) {
std::getline(src2, line_buf);
dest << line_buf << " ";
}
dest << std::endl;
}
src1.close();
src2.close();
dest.close();
std::cout << "All done" << std::endl;
return 0;
}
开发者ID:Zaytceva,项目名称:cpp.fundamentals,代码行数:42,代码来源:mix_files.cpp
示例3: MessageHandler
/**
* Handle a netlink message. If this message is a routing table message and it
* contains the default route, then either:
* i) default_gateway is updated with the address of the gateway.
* ii) if_index is updated with the interface index for the default route.
* @param if_index[out] possibly updated with interface index for the default
* route.
* @param default_gateway[out] possibly updated with the default gateway.
* @param nl_hdr the netlink message.
*/
void MessageHandler(int32_t *if_index,
IPV4Address *default_gateway,
const struct nlmsghdr *nl_hdr) {
// Unless RTA_DST is provided, an RTA_GATEWAY or RTA_OIF attribute implies
// it's the default route.
IPV4Address gateway;
int32_t index = Interface::DEFAULT_INDEX;
bool is_default_route = true;
// Loop over the attributes looking for RTA_GATEWAY and/or RTA_DST
const rtmsg *rt_msg = reinterpret_cast<const rtmsg*>(NLMSG_DATA(nl_hdr));
if (rt_msg->rtm_family == AF_INET && rt_msg->rtm_table == RT_TABLE_MAIN) {
int rt_len = RTM_PAYLOAD(nl_hdr);
for (const rtattr* rt_attr = reinterpret_cast<const rtattr*>(
RTM_RTA(rt_msg));
RTA_OK(rt_attr, rt_len);
rt_attr = RTA_NEXT(rt_attr, rt_len)) {
switch (rt_attr->rta_type) {
case RTA_OIF:
index = *(reinterpret_cast<int32_t*>(RTA_DATA(rt_attr)));
break;
case RTA_GATEWAY:
gateway = IPV4Address(
reinterpret_cast<const in_addr*>(RTA_DATA(rt_attr))->s_addr);
break;
case RTA_DST:
IPV4Address dest(
reinterpret_cast<const in_addr*>(RTA_DATA(rt_attr))->s_addr);
is_default_route = dest.IsWildcard();
break;
}
}
}
if (is_default_route &&
(!gateway.IsWildcard() || index != Interface::DEFAULT_INDEX)) {
*default_gateway = gateway;
*if_index = index;
}
}
开发者ID:brunchboy,项目名称:ola,代码行数:52,代码来源:NetworkUtils.cpp
示例4: string_format
void mdeath::boomer(monster *z)
{
std::string explode = string_format(_("a %s explode!"), z->name().c_str());
sounds::sound(z->pos(), 24, explode);
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
tripoint dest( z->posx() + i, z->posy() + j, z->posz() );
g->m.bash( dest, 10 );
g->m.add_field( dest, fd_bile, 1, 0 );
int mondex = g->mon_at( dest );
if (mondex != -1) {
g->zombie(mondex).stumble(false);
g->zombie(mondex).moves -= 250;
}
}
}
if (rl_dist( z->pos(), g->u.pos() ) == 1) {
g->u.add_env_effect("boomered", bp_eyes, 2, 24);
}
}
开发者ID:cwc,项目名称:Cataclysm-DDA,代码行数:20,代码来源:mondeath.cpp
示例5: dest
void TileSetImage::draw(GMSpriteBatch* s, const GMRect2D &_dest, double radian, int gid) const{
if(!gid) return;
gid -= m_parent->getFirstGit();
GMRect2D dest(_dest.x, _dest.y, _dest.width, _dest.height);
if(radian==0.5*M_PI || radian == -0.5*M_PI){
dest.width = _dest.height;
dest.height = _dest.width;
}
if(radian == -0.5*M_PI){
dest.y+=dest.width;
}else if(radian == 0.5*M_PI){
dest.x+=dest.height;
}
GMRect2D src(
(gid%m_TileXNum)*m_parent->getTileWidth(),
(gid/m_TileXNum)*m_parent->getTileHeight(),
m_parent->getTileWidth(),
m_parent->getTileHeight());
s->draw(m_tex, dest, src, GMColor::White, radian, 0, GMSpriteFlipHorizontally);
}
开发者ID:nanathia,项目名称:tenninoboru_ketui,代码行数:20,代码来源:TileSet.cpp
示例6: im_local
/* Make something local to an image descriptor ... pass in a constructor
* and a destructor, plus three args.
*/
void *
im_local( IMAGE *im,
im_construct_fn cons, im_callback_fn dest, void *a, void *b, void *c )
{
void *obj;
if( !im ) {
im_error( "im_local", "%s", _( "NULL image descriptor" ) );
return( NULL );
}
if( !(obj = cons( a, b, c )) )
return( NULL );
if( im_add_close_callback( im, (im_callback_fn) dest, obj, a ) ) {
dest( obj, a );
return( NULL );
}
return( obj );
}
开发者ID:alon,项目名称:libvips,代码行数:23,代码来源:vips7compat.c
示例7: dest
bool Arena::HookHandleRepop(Player * plr)
{
// 559, 562, 572
/*
A start
H start
Repop
572 1295.322388 1585.953369 31.605387
572 1277.105103 1743.956177 31.603209
572 1286.112061 1668.334961 39.289127
562 6184.806641 236.643463 5.037095
562 6292.032227 287.570343 5.003577
562 6241.171875 261.067322 0.891833
559 4085.861328 2866.750488 12.417445
559 4027.004883 2976.964844 11.600499
559 4057.042725 2918.686523 13.051933
*/
LocationVector dest(0,0,0,0);
switch(m_mapMgr->GetMapId())
{
/* loraedeon */
case 572: {
dest.ChangeCoords(1286.112061f, 1668.334961f, 39.289127f);
}break;
/* blades edge arena */
case 562: {
dest.ChangeCoords(6241.171875f, 261.067322f, 0.891833f);
}break;
/* nagrand arena */
case 559: {
dest.ChangeCoords(4057.042725f, 2918.686523f, 13.051933f);
}break;
}
plr->SafeTeleport(m_mapMgr->GetMapId(), m_mapMgr->GetInstanceID(), dest);
return true;
}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:41,代码来源:Arenas.cpp
示例8: float
void
BasicCompositor::EndFrame()
{
// Pop aClipRectIn/bounds rect
mRenderTarget->mDrawTarget->PopClip();
if (gfxPrefs::WidgetUpdateFlashing()) {
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
// We're still clipped to mInvalidRegion, so just fill the bounds.
mRenderTarget->mDrawTarget->FillRect(ToRect(mInvalidRegion.GetBounds()),
ColorPattern(Color(r, g, b, 0.2f)));
}
// Pop aInvalidregion
mRenderTarget->mDrawTarget->PopClip();
// Note: Most platforms require us to buffer drawing to the widget surface.
// That's why we don't draw to mDrawTarget directly.
RefPtr<SourceSurface> source = mRenderTarget->mDrawTarget->Snapshot();
RefPtr<DrawTarget> dest(mTarget ? mTarget : mDrawTarget);
nsIntPoint offset = mTarget ? mTargetBounds.TopLeft() : nsIntPoint();
// The source DrawTarget is clipped to the invalidation region, so we have
// to copy the individual rectangles in the region or else we'll draw blank
// pixels.
nsIntRegionRectIterator iter(mInvalidRegion);
for (const IntRect *r = iter.Next(); r; r = iter.Next()) {
dest->CopySurface(source,
IntRect(r->x - mInvalidRect.x, r->y - mInvalidRect.y, r->width, r->height),
IntPoint(r->x - offset.x, r->y - offset.y));
}
if (!mTarget) {
mWidget->EndRemoteDrawingInRegion(mDrawTarget, mInvalidRegion);
}
mDrawTarget = nullptr;
mRenderTarget = nullptr;
}
开发者ID:hoosteeno,项目名称:gecko-dev,代码行数:41,代码来源:BasicCompositor.cpp
示例9: current
int
gams::platforms::BasePlatform::move(const pose::Position & target,
const pose::PositionBounds &bounds)
{
int result = 0;
pose::Position current(get_location());
pose::Position dest(get_frame(), 0, 0);
dest.from_container(self_->agent.dest);
pose::Position gps_target(get_frame(), target);
/**
* if we are not paused, we are not already at the target,
* and we are either not moving or the target is different
* from the existing move location, then set status to
* moving and return 1(moving to the new location)
**/
if (!*status_.paused_moving && !(gps_target == current) &&
(!*status_.moving || !(gps_target == dest)))
{
self_->agent.source = self_->agent.location;
gps_target.to_container(self_->agent.dest);
result = 1;
status_.moving = 1;
}
/**
* otherwise, if we are approximately at the target location,
* change status and paused to 0 and return 2(arrived)
**/
else if (bounds.check_position(target, current))
{
status_.moving = 0;
status_.paused_moving = 0;
result = 2;
}
return result;
}
开发者ID:jredmondson,项目名称:gams,代码行数:41,代码来源:BasePlatform.cpp
示例10: src
TUint8 *cstrFromUtf16(const TText *aUtf16, TInt aLength, TInt &outputBytes)
{
TPtrC16 src(aUtf16, aLength);
TPtr8 nulldest(0,0);
TInt len = CnvUtfConverter::ConvertFromUnicodeToUtf8(nulldest, src);
if(len<0)
{
dbg << Log::Indent() << "ConvertFromUnicodeToUtf8 failed" << Log::Endl();
FatalError();
}
TUint8 *buf = new TUint8[len+1];
TPtr8 dest(buf, len);
(void) CnvUtfConverter::ConvertFromUnicodeToUtf8(dest, src);
buf[len] = 0; // Add NUL termination in case it is used with windows APIs
outputBytes = dest.Length();
return buf;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:21,代码来源:stringconv.cpp
示例11: dest
bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool /*forceDest*/)
{
float x, y, z;
_sourceUnit->GetPosition(x, y, z);
if (!Trinity::IsValidMapCoord(destX, destY, destZ) || !Trinity::IsValidMapCoord(x, y, z))
return false;
G3D::Vector3 dest(destX, destY, destZ);
SetEndPosition(dest);
SetActualEndPosition(GetEndPosition());
G3D::Vector3 start(x, y, z);
SetStartPosition(start);
TC_LOG_DEBUG("maps", "++ PathGenerator::CalculatePath() for %u\n", _sourceUnit->GetGUIDLow());
BuildShortcut();
_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
return true;
}
开发者ID:Exodius,项目名称:chuspi,代码行数:21,代码来源:PathGenerator.cpp
示例12: dest
const math::matrix<4> math::frustum(float l, float r, float b, float t, float n, float f)
{
float n2 = 2 * n;
float rl = r - l;
float tb = t - b;
float fn = f - n;
matrix<4> dest = zero;
dest(0,0) = n2/rl;
dest(0,2) = (r+l)/rl;
dest(1,1) = n2/tb;
dest(1,2) = (t+b)/tb;
dest(2,2) = -(f+n)/fn;
dest(2,3) = -2*f*n/fn;
dest(3,2) = -1;
return dest;
}
开发者ID:wjzhou,项目名称:raytracer,代码行数:19,代码来源:matrix4.cpp
示例13: src
void Stoneship::telescopeLighthouseDraw() {
if (_telescopePosition > 1137 && _telescopePosition < 1294) {
uint16 imageId = _telescopeLighthouseOff;
if (_state.generatorPowerAvailable == 1 && _telescopeLighthouseState)
imageId = _telescopeLighthouseOn;
Common::Rect src(1205, 0, 1205 + 131, 112);
src.clip(Common::Rect(_telescopePosition, 0, _telescopePosition + 112, 112));
src.translate(-1205, 0);
src.clip(131, 112);
Common::Rect dest(_telescopePosition, 0, _telescopePosition + 112, 112);
dest.clip(Common::Rect(1205, 0, 1205 + 131, 112));
dest.translate(-_telescopePosition, 0);
dest.clip(112, 112);
dest.translate(222, 112);
_vm->_gfx->copyImageSectionToScreen(imageId, src, dest);
}
}
开发者ID:jweinberg,项目名称:scummvm,代码行数:21,代码来源:stoneship.cpp
示例14: dest
bool FileEntry::Extract(const StringRef& outDir) const
{
auto path = Path::Combine(outDir, mPath);
Directory::CreateDirectoryForFile(path);
FileStream dest(path, FileOpenMode::DestoryWriteOrCreate, FileDataType::Binary);
if (!dest.IsOpen())
{
Log::FormatError("Cannot create {}", path);
return false;
}
auto readStream = Read(FileDataType::Binary);
auto writeSize = readStream->CopyTo(dest);
auto extractSize = ExtractedSize();
if (writeSize!= extractSize)
{
Log::FormatError("Cannot Extract {}", path);
return false;
}
return true;
}
开发者ID:fjz13,项目名称:Medusa,代码行数:21,代码来源:FileEntry.cpp
示例15: source
void ModEditWindow::CopyFiles(wxWindow *window, wxArrayString files, wxString destDir)
{
for (wxArrayString::const_iterator iter = files.begin(); iter != files.end(); ++iter)
{
wxFileName source (*iter);
wxString fileName = source.GetFullName();
wxFileName dest(Path::Combine(destDir, fileName));
if (wxFileName::DirExists(*iter))
{
// TODO make the file copy task copy the file list all in one go.
FileCopyTask *task = new FileCopyTask(*iter, dest.GetFullPath());
TaskProgressDialog dlg(window);
dlg.ShowModal(task);
delete task;
}
else
{
wxCopyFile(*iter, dest.GetFullPath());
}
}
}
开发者ID:Kuchikixx,项目名称:MultiMC4,代码行数:21,代码来源:modeditwindow.cpp
示例16: snow_iosrc_file_read
value snow_iosrc_file_read(value _handle, value _dest, value _size, value _maxnum) {
snow::io::iosrc_file* iosrc = snow::from_hx<snow::io::iosrc_file>( _handle );
QuickVec<unsigned char> buffer;
if( iosrc ) {
if(!val_is_null(_dest)) {
ByteArray dest(_dest);
int res = snow::io::read(iosrc->file_source, dest.Bytes(), val_int(_size), val_int(_maxnum));
return alloc_int(res);
}
} //object from hx
return alloc_int(-1);
} DEFINE_PRIM(snow_iosrc_file_read, 4);
开发者ID:RealyUniqueName,项目名称:snow,代码行数:21,代码来源:snow_hx_bindings.cpp
示例17: dest
void CPixmap::toBlackAndWhite() {
m_effects.push_back(CEffect::BlackAndWhite);
QImage img = this->toImage();
QImage dest(img.size(), img.format());
QColor pixel;
for(int x=0; x<img.width(); x++) {
for (int y=0; y<img.height(); y++) {
pixel = img.pixel(x, y);
unsigned int average = (pixel.green()+ pixel.red() + pixel.blue()) / 3;
if(average > 127)
average = 255;
else
average = 0;
pixel.setGreen(average);
pixel.setBlue(average);
pixel.setRed(average);
dest.setPixel(x,y,pixel.rgb());
}
}
updateImage(dest);
}
开发者ID:vince06fr,项目名称:fotowall,代码行数:21,代码来源:CPixmap.cpp
示例18: size
//==============================================================================
string stringarray::joinintostring (const string& separator, int start, int numbertojoin) const
{
const int last = (numbertojoin < 0) ? size()
: std::min (size(), start + numbertojoin);
if (start < 0)
start = 0;
if (start >= last)
return string::empty;
if (start == last - 1)
return strings.getreference (start);
const size_t separatorbytes = separator.getcharpointer().sizeinbytes() - sizeof (string::charpointertype::chartype);
size_t bytesneeded = separatorbytes * (size_t) (last - start - 1);
for (int i = start; i < last; ++i)
bytesneeded += strings.getreference(i).getcharpointer().sizeinbytes() - sizeof (string::charpointertype::chartype);
string result;
result.preallocatebytes (bytesneeded);
string::charpointertype dest (result.getcharpointer());
while (start < last)
{
const string& s = strings.getreference (start);
if (! s.isempty())
dest.writeall (s.getcharpointer());
if (++start < last && separatorbytes > 0)
dest.writeall (separator.getcharpointer());
}
dest.writenull();
return result;
}
开发者ID:moorecoin,项目名称:MooreCoinService,代码行数:41,代码来源:StringArray.cpp
示例19: currPathTarget
void AiCombat::buildNewPath(const MWWorld::Ptr& actor, const MWWorld::Ptr& target)
{
Ogre::Vector3 newPathTarget = Ogre::Vector3(target.getRefData().getPosition().pos);
float dist;
if(!mPathFinder.getPath().empty())
{
ESM::Pathgrid::Point lastPt = mPathFinder.getPath().back();
Ogre::Vector3 currPathTarget(PathFinder::MakeOgreVector3(lastPt));
dist = (newPathTarget - currPathTarget).length();
}
else dist = 1e+38F; // necessarily construct a new path
float targetPosThreshold = (actor.getCell()->getCell()->isExterior())? 300.0f : 100.0f;
//construct new path only if target has moved away more than on [targetPosThreshold]
if(dist > targetPosThreshold)
{
ESM::Position pos = actor.getRefData().getPosition();
ESM::Pathgrid::Point start(PathFinder::MakePathgridPoint(pos));
ESM::Pathgrid::Point dest(PathFinder::MakePathgridPoint(newPathTarget));
if(!mPathFinder.isPathConstructed())
mPathFinder.buildPath(start, dest, actor.getCell(), false);
else
{
PathFinder newPathFinder;
newPathFinder.buildPath(start, dest, actor.getCell(), false);
if(!mPathFinder.getPath().empty())
{
newPathFinder.syncStart(mPathFinder.getPath());
mPathFinder = newPathFinder;
}
}
}
}
开发者ID:Kleptoid,项目名称:openmw,代码行数:40,代码来源:aicombat.cpp
示例20: waterPlane
bool SimpleWater::initialize()
{
try {
Ogre::Plane waterPlane(Ogre::Vector3::UNIT_Y, 0);
Ogre::Real farClipDistance = mCamera.getFarClipDistance();
float textureSize = 10.0f;
float planeSize = (farClipDistance + textureSize) * 2;
// create a water plane/scene node
Ogre::MeshManager::getSingleton().createPlane("SimpleWaterPlane", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, waterPlane, planeSize, planeSize, 5, 5, true, 1, planeSize / textureSize, planeSize / textureSize, Ogre::Vector3::UNIT_Z);
mWaterNode = mSceneMgr.getRootSceneNode()->createChildSceneNode("water");
mWaterBobbingNode = mWaterNode->createChildSceneNode();
mWaterEntity = mSceneMgr.createEntity("water", "SimpleWaterPlane");
mWaterEntity->setMaterialName("/global/environment/water/ocean");
//Render the water very late on, so that any transparent entity which is half submerged is already rendered.
mWaterEntity->setRenderQueueGroup(Ogre::RENDER_QUEUE_8);
mWaterEntity->setCastShadows(false);
mWaterEntity->setQueryFlags(MousePicker::CM_NATURE);
mWaterBobbingNode->attachObject(mWaterEntity);
mRenderTargetListener = new WaterAdjustRenderTargetListener(mWaterNode, textureSize, textureSize);
mMainRenderTarget.addListener(mRenderTargetListener);
Ogre::ControllerFunctionRealPtr func(OGRE_NEW Ogre::WaveformControllerFunction(Ogre::WFT_SINE, 0, 0.1));
Ogre::ControllerValueRealPtr dest(OGRE_NEW NodeAnimator(*mWaterBobbingNode, Ogre::Vector3(0, 1, 0)));
Ogre::ControllerManager& cm = Ogre::ControllerManager::getSingleton();
mWaterBobbingController = cm.createController(cm.getFrameTimeSource(), dest, func);
return true;
} catch (const std::exception& ex) {
S_LOG_FAILURE("Error when creating simple water." << ex);
return false;
}
}
开发者ID:Laefy,项目名称:ember,代码行数:39,代码来源:SimpleWater.cpp
注:本文中的dest函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论