亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? vector.cpp

?? 利用vc開發gis系統有用的可以下一下哈歡迎大家使用
?? CPP
字號:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Vector.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
//構造函數
TGisVectorLayer::TGisVectorLayer()
{
  m_lpPolygonList=NULL;
  m_nSelectID = -1;
}
//---------------------------------------------------------------------------
//析構函數
TGisVectorLayer::~TGisVectorLayer()
{
 if(m_lpPolygonList)
   {
    //釋放資源
    for(int i=0;i<m_lpPolygonList->Count;i++)
      {
       delete m_lpPolygonList->Items[i];
      }
    delete m_lpPolygonList;
   }
}
//---------------------------------------------------------------------------
//讀入Idris格式的矢量文件
BOOL TGisVectorLayer::OpenIdrisFile(AnsiString FileName)
{
  //首先讀入文件頭
  AnsiString DocFileName= ChangeFileExt(FileName,".dvc");
  TStringList *StringList1=new TStringList();
  StringList1->LoadFromFile(DocFileName);

  AnsiString type=StringList1->Strings[3].SubString(15,StringList1->Strings[4].Length()-13);
  if(type=="polygon")
    m_gisFileHeader.giType=GIS_POLYGON;
  else if(type=="point")
    m_gisFileHeader.giType=GIS_POINT;
  else
    m_gisFileHeader.giType=GIS_LINE;

  m_gisFileHeader.giMinX = StringList1->Strings[7].SubString(15,StringList1->Strings[7].Length()-13).ToDouble();
  m_gisFileHeader.giMaxX = StringList1->Strings[8].SubString(15,StringList1->Strings[8].Length()-13).ToDouble();
  m_gisFileHeader.giMinY = StringList1->Strings[9].SubString(15,StringList1->Strings[9].Length()-13).ToDouble();
  m_gisFileHeader.giMaxY = StringList1->Strings[10].SubString(15,StringList1->Strings[10].Length()-13).ToDouble();
  delete StringList1;

  TFileStream* File=new TFileStream(FileName,fmOpenRead);
  if(m_gisFileHeader.giType==GIS_POLYGON
    || m_gisFileHeader.giType==GIS_LINE)
  {
    m_lpPolygonList=new TList;
    float test[2];
    File->Read(test,8);
    do
    {
      LPGISPOLYGON polygon = new GISPOLYGON;
      polygon->point = new GISPOINT[test[1]];
      polygon->pPen = new TPen;
      polygon->pBrush = new TBrush;
      polygon->id=test[0];
      polygon->numberPoint=test[1];
      File->Read((float*)polygon->point ,4*2*test[1]);
      //計算多邊形的外包圍矩形
      polygon->outRect.x1=polygon->point[0].x;
      polygon->outRect.x2=polygon->point[0].x;
      polygon->outRect.y1=polygon->point[0].y;
      polygon->outRect.y2=polygon->point[0].y;
      for(int i=1;i<test[1];i++)
      {
        if(polygon->outRect.x1>polygon->point[i].x)
        polygon->outRect.x1=polygon->point[i].x;
        if(polygon->outRect.x2<polygon->point[i].x)
          polygon->outRect.x2=polygon->point[i].x;
        if(polygon->outRect.y1>polygon->point[i].y)
          polygon->outRect.y1=polygon->point[i].y;
        if(polygon->outRect.y2<polygon->point[i].y)
          polygon->outRect.y2=polygon->point[i].y;
      }
      m_lpPolygonList->Add (polygon);
      File->Read(test,8);
    }while(test[0]!=0 && test[1]!=0);
  }
  delete File;
  return TRUE;
}
//---------------------------------------------------------------------------
//繪制函數
void TGisVectorLayer::Draw(TCanvas* canvas,GISRECT SourceRect,TRect DestRect)
{
 m_DrawRect=DestRect;
 m_gisSourceRect=SourceRect;
 m_canvas=canvas;

 m_ratioX=DestRect.Width() /(SourceRect.x2-SourceRect.x1);
 m_ratioY=DestRect.Height()/(SourceRect.y2-SourceRect.y1);

 canvas->Brush->Color=clBlack;
 if(m_gisFileHeader.giType==GIS_POLYGON
    || m_gisFileHeader.giType==GIS_LINE)
 {
  for(int i=0;i<m_lpPolygonList->Count;i++)
  {
   LPGISPOLYGON polygon=(GISPOLYGON*)m_lpPolygonList->Items[i];
   DrawAPolygon(polygon,SourceRect,DestRect);
   if(i == m_nSelectID)
   {
     DrawSelectPolygon(SourceRect,DestRect);
   }
  }
 }
}
//---------------------------------------------------------------------------
//繪制一個多邊形
void TGisVectorLayer::DrawAPolygon(LPGISPOLYGON polygon,GISRECT SourceRect,TRect DestRect)
{
   int pointCount=polygon->numberPoint ;
   TPoint* points = new TPoint[pointCount];
   for(int i=0; i<pointCount; i++)
   {
     points[i].x = m_ratioX*(polygon->point[i].x-SourceRect.x1);
     points[i].y = DestRect.Height()-m_ratioY*(polygon->point[i].y-SourceRect.y1);
   }

   m_canvas->Pen->Style = polygon->pPen->Style;
   m_canvas->Pen->Width = polygon->pPen->Width;
   m_canvas->Pen->Color = polygon->pPen->Color;
   m_canvas->Brush->Style = polygon->pBrush->Style;
   m_canvas->Brush->Color = polygon->pBrush->Color;
   if(polygon->pBrush->Bitmap)
   {
     m_canvas->Brush->Bitmap = polygon->pBrush->Bitmap;
   }
   m_canvas->Polygon(points, pointCount-1);
   m_canvas->Brush->Bitmap = NULL;
   delete points;
}
//---------------------------------------------------------------------------
//用于判斷一個點是否在一個多邊形中
//返回TRUE:表示點在多邊形中,否則點不在多邊形中
BOOL TGisVectorLayer::PointIsInPolygon(LPGISPOLYGON polygon,GISPOINT point)
{
 //如果點在多邊形的外包圍矩形外,那么肯定沒有交點
 if(   point.x < polygon->outRect.x1
    || point.x > polygon->outRect.x2
    || point.y < polygon->outRect.y1
    || point.y > polygon->outRect.y2)
    return FALSE;

 int count=0;
 for(int i=0;i<polygon->numberPoint-1;i++)
 {
  GISLINE tempLine(polygon->point[i].x,
                   polygon->point[i].y,
                   polygon->point[i+1].x,
                   polygon->point[i+1].y);
  if(point.y < tempLine.Y1 && point.y < tempLine.Y2)
    continue;
  float a;
  float b;
  if(tempLine.X2==tempLine.X1)
    continue;
  a=(tempLine.Y2-tempLine.Y1)/(tempLine.X2-tempLine.X1);
  b=tempLine.Y1-a*tempLine.X1;
  float y=a*point.x+b;
  if(y<point.y
     && y<=(tempLine.Y1>tempLine.Y2 ? tempLine.Y1 : tempLine.Y2)
     && y>=(tempLine.Y1<tempLine.Y2? tempLine.Y1 : tempLine.Y2)
     && point.x<=(tempLine.X1>tempLine.X2 ? tempLine.X1 : tempLine.X2)
     && point.x>=(tempLine.X1<tempLine.X2 ? tempLine.X1 : tempLine.X2))
    count++;
 }

 if(count%2)
   return TRUE;
 else
   return FALSE;
}
//---------------------------------------------------------------------------
//將行列值的坐標變換成X、Y值坐標
GISPOINT TGisVectorLayer::TPointToGisPoint(TPoint SourcePoint)
{
 GISPOINT point;
 point.x= SourcePoint.x/m_ratioX + m_gisFileHeader.giMinX;
 point.y= (m_DrawRect.Height()-SourcePoint.y)/m_ratioY + m_gisFileHeader.giMinY;
 return point;
}
//---------------------------------------------------------------------------
//選擇多邊形函數
void TGisVectorLayer::SelectPolygon(TPoint SourcePoint)
{
 for(int i=0;i<m_lpPolygonList->Count;i++)
 {
  GISPOINT point=TPointToGisPoint(SourcePoint);
  if(PointIsInPolygon((GISPOLYGON*)(m_lpPolygonList->Items[i]),point))
  {
   m_nSelectID = i;
   return;
  }
 }

 m_nSelectID = -1;
}
//---------------------------------------------------------------------------
void TGisVectorLayer::DrawSelPlyWithBitmap(GISRECT SourceRect,TRect DestRect)
{/*
    Graphics::TBitmap *BrushBmp = new Graphics::TBitmap;
    try
    {
      LPGISPOLYGON polygon = (GISPOLYGON*)m_lpPolygonList->Items[m_nSelectID];
      int pointCount=polygon->numberPoint ;
      BrushBmp->LoadFromFile(m_strBitmapFileName);
      m_canvas->Brush->Bitmap = BrushBmp;
      TPoint* points = new TPoint[pointCount];
   for(int i=0; i<pointCount; i++)
   {
     points[i].x=ratioX*(polygon->point[i].x-SourceRect.x1);
     points[i].y=DestRect.Height()-ratioY*(polygon->point[i].y-SourceRect.y1);
   }
   m_canvas->Polygon(points, pointCount-1);
   delete points;
      m_canvas->Brush->Bitmap = NULL;
    }
    __finally
    {
      m_canvas->Brush->Bitmap = NULL;
      delete BrushBmp;
    }               */
}
//---------------------------------------------------------------------------
void TGisVectorLayer::DrawSelectPolygon(GISRECT SourceRect,TRect DestRect)
{
  TColor oldColor = m_canvas->Brush->Color; //保存原畫刷顏色
  LPGISPOLYGON polygon = (GISPOLYGON*)m_lpPolygonList->Items[m_nSelectID];
  //在本次所選擇的多邊形中填充紅色
  m_canvas->Brush->Color=clRed;
  int pointCount=polygon->numberPoint ;
  TPoint* points = new TPoint[pointCount];
  for(int i=0; i<pointCount; i++)
  {
    points[i].x=m_ratioX*(polygon->point[i].x-SourceRect.x1);
    points[i].y=DestRect.Height()-m_ratioY*(polygon->point[i].y-SourceRect.y1);
  }
  m_canvas->Pen->Style = polygon->pPen->Style;
  m_canvas->Pen->Width = polygon->pPen->Width;
  m_canvas->Pen->Color = polygon->pPen->Color;
  m_canvas->Polygon(points, pointCount-1);
  delete points;
  m_canvas->Brush->Color=oldColor; //恢復使用原畫刷顏色
}
//---------------------------------------------------------------------------
void TGisVectorLayer::SetBitmapBrush(AnsiString strBitmapFile)
{
  LPGISPOLYGON polygon = (GISPOLYGON*)m_lpPolygonList->Items[m_nSelectID];
  Graphics::TBitmap *BrushBmp = new Graphics::TBitmap;
  BrushBmp->LoadFromFile(strBitmapFile);
  polygon->pBrush->Bitmap = BrushBmp;
}
//---------------------------------------------------------------------------
//將圖形坐標的點轉換成屏幕坐標
TPoint TGisVectorLayer:: GisPointToTPoint(GISPOINT SourcePoint)
{
  TPoint point;
  point.x = (SourcePoint.x - m_gisFileHeader.giMinX)*m_ratioX;
  point.y = m_DrawRect.Height() - (SourcePoint.y - m_gisFileHeader.giMinY)*m_ratioY;
  return point;
}
//---------------------------------------------------------------------------
//將圖形坐標中的矩形轉變為屏幕坐標
TRect  TGisVectorLayer::GisRectToTRect(GISRECT SourceRect)
{
  GISPOINT pt1, pt2;
  pt1.x = SourceRect.x1;
  pt1.y = SourceRect.y1;
  pt2.x = SourceRect.x2;
  pt2.y = SourceRect.y2;
  TPoint point1, point2;
  point1 = GisPointToTPoint(pt1);
  point2 = GisPointToTPoint(pt2);
  return TRect(point1,point2);
}
//---------------------------------------------------------------------------

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99re热这里只有精品免费视频| 26uuu欧美日本| 欧美一级艳片视频免费观看| 久久久久国产一区二区三区四区| 亚洲精品国产无天堂网2021| 国产一区日韩二区欧美三区| 色综合色综合色综合色综合色综合| 日韩欧美亚洲国产另类| 亚洲精选视频在线| 国产成人精品亚洲777人妖| 欧美日本一区二区在线观看| 国产精品久久精品日日| 久久99国产精品久久99果冻传媒| 在线观看免费视频综合| 日本一区二区三区高清不卡| 老色鬼精品视频在线观看播放| 91美女视频网站| 日本一二三四高清不卡| 麻豆精品视频在线观看| 欧美日韩一区精品| 亚洲摸摸操操av| 成a人片亚洲日本久久| 国产亚洲成年网址在线观看| 日韩国产一区二| 欧美日韩极品在线观看一区| 亚洲欧美视频在线观看| 成人午夜激情视频| 国产三级欧美三级日产三级99 | 亚洲午夜羞羞片| 成人一二三区视频| 国产亚洲精品免费| 国产资源精品在线观看| 欧美成人免费网站| 久草精品在线观看| 久久久久久久av麻豆果冻| 狠狠久久亚洲欧美| 久久精品日产第一区二区三区高清版| 久久精品久久久精品美女| 欧美一区二区精品| 久久99精品国产麻豆婷婷| 精品粉嫩超白一线天av| 国内成人精品2018免费看| www激情久久| 国产成人精品免费| 最新高清无码专区| 在线免费观看日韩欧美| 亚洲影视在线播放| 777亚洲妇女| 经典一区二区三区| 国产精品色一区二区三区| av中文字幕一区| 亚洲综合色网站| 欧美一区二区网站| 国产成人在线视频网站| 国产精品久久久久久久久图文区| 在线观看视频一区二区| 日本一不卡视频| 久久久亚洲国产美女国产盗摄 | 欧美精品精品一区| 日韩电影在线免费看| 精品不卡在线视频| 成人网男人的天堂| 亚洲h动漫在线| 精品国产伦一区二区三区免费| 国产成人av电影在线| 亚洲精品水蜜桃| 欧美本精品男人aⅴ天堂| 成人国产精品免费| 五月天国产精品| 国产午夜久久久久| 欧美色欧美亚洲另类二区| 理论电影国产精品| 亚洲免费在线视频一区 二区| 91精品国产乱| 97久久精品人人澡人人爽| 午夜精品久久久久久久99樱桃| www国产精品av| 91国偷自产一区二区三区成为亚洲经典 | 精品少妇一区二区| 91老师国产黑色丝袜在线| 男男成人高潮片免费网站| 欧美国产禁国产网站cc| 欧美日韩国产高清一区二区三区| 国产一区在线看| 亚洲va欧美va人人爽| 国产精品嫩草影院com| 欧美一区二区三区成人| 91一区一区三区| 国产一区二区三区观看| 午夜一区二区三区在线观看| 中文无字幕一区二区三区 | 亚洲福利一二三区| 中文字幕av免费专区久久| 欧美一级艳片视频免费观看| www.欧美亚洲| 国产成人综合精品三级| 另类小说欧美激情| 婷婷国产v国产偷v亚洲高清| 日韩理论电影院| 国产人伦精品一区二区| 精品国产一区二区三区av性色| 欧美精品免费视频| 91免费观看视频| voyeur盗摄精品| 国产一区二区按摩在线观看| 日韩经典中文字幕一区| 亚洲最大成人综合| 亚洲美女在线一区| 日韩伦理电影网| 中文字幕一区二区三区视频| 久久久亚洲国产美女国产盗摄 | 色呦呦网站一区| 波多野结衣在线aⅴ中文字幕不卡| 久久不见久久见免费视频7| 日本不卡一二三区黄网| 三级一区在线视频先锋 | 欧美日韩激情一区二区| 91国偷自产一区二区使用方法| zzijzzij亚洲日本少妇熟睡| 成人动漫精品一区二区| 国产丶欧美丶日本不卡视频| 国产高清精品久久久久| 国产ts人妖一区二区| 成人黄色软件下载| av电影在线观看一区| 色综合天天综合狠狠| 色综合天天综合网天天狠天天| 日本乱人伦aⅴ精品| 欧美午夜在线一二页| 欧美日韩亚洲丝袜制服| 91精品蜜臀在线一区尤物| 欧美成人vps| 欧美极品aⅴ影院| 亚洲视频在线一区观看| 亚洲一区二区欧美日韩| 日日夜夜免费精品| 久久精品免费观看| 成人三级在线视频| 欧洲国内综合视频| 欧美一级日韩不卡播放免费| 精品国内片67194| 国产精品天干天干在线综合| 亚洲欧美在线视频| 视频一区欧美精品| 国产一区二区三区四区在线观看| 成人黄色在线网站| 欧美日本不卡视频| 久久久亚洲午夜电影| 亚洲精品中文在线影院| 日韩黄色片在线观看| 国产在线观看免费一区| 一本久久综合亚洲鲁鲁五月天| 欧美日韩视频专区在线播放| 精品国产99国产精品| 日韩毛片在线免费观看| 欧美aaaaa成人免费观看视频| 国产高清不卡二三区| 欧美吻胸吃奶大尺度电影 | 欧美成人精品3d动漫h| 中文字幕一区二区三中文字幕| 天堂成人免费av电影一区| 国产99久久久久| 在线不卡的av| 国产精品免费视频观看| 日本午夜一区二区| 99国产精品国产精品久久| 日韩欧美久久一区| 亚洲一区二区三区四区在线免费观看| 蜜臀av一区二区在线免费观看 | 久久久久久久精| 亚洲成人黄色影院| 成人精品一区二区三区中文字幕 | 一个色综合av| 国产一区二区影院| 欧美一级在线免费| 亚洲一区二区三区在线播放| 高清shemale亚洲人妖| 91精品国产福利| 一个色在线综合| 99久久综合精品| 国产日产精品一区| 国内久久精品视频| 欧美丰满嫩嫩电影| 亚洲综合色婷婷| 91免费视频网| 国产精品久久久久影院亚瑟| 久久丁香综合五月国产三级网站 | 不卡一区二区中文字幕| 欧美大度的电影原声| 婷婷六月综合网| 91成人网在线| 国产精品福利一区| 成人黄色777网| 国产亚洲精品资源在线26u| 久久不见久久见中文字幕免费| 91麻豆精品国产91久久久| 五月婷婷色综合| 欧美私人免费视频| 亚洲午夜精品网| 欧美日韩欧美一区二区|