当前位置: 首页>>代码示例>>C++>>正文


C++ dest函数代码示例

本文整理汇总了C++中dest函数的典型用法代码示例。如果您正苦于以下问题:C++ dest函数的具体用法?C++ dest怎么用?C++ dest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dest函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的dest函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。