四 處理多多邊形

2022-08-24 12:03:09 字數 2400 閱讀 6743

處理多多邊形跟處理多邊形差不多,就是多一層迴圈,然後把需要的gpu資訊存起來就行

bool akgiswidget::sendgpumultipolygon(ogrmultipolygon *pmultipolygonin)

;qopenglbuffer *ebo;//;

vao = new qopenglvertexarrayobject;

vbo = new qopenglbuffer(qopenglbuffer::vertexbuffer);

//    ebo = new qopenglbuffer(qopenglbuffer::indexbuffer);

int pointscount =0;

int sizeoffset = 0;

int countoffset = 0;

featuredesc featuredesc;

featuredesc.vecvex.push_back(0);

featuredesc.vecidx.push_back(0);

int polycnt= pmultipolygonin->getnumgeometries();

std::vectorverticess;   //所有點

std::vectorindicess;   //所有索引

//迴圈多邊形

for (int i = 0; i < polycnt; ++i)

);vertices[index] =  pttemp.getx();

vertices[index + 1] = pttemp.gety();

vertices[index + 2] = 0.5;

vertices[index + 3] = 0.6;

vertices[index + 4] = 0.1;

index += 5;

}for (int i = 0; i < index; ++i) 

polygon.emplace_back(exteriorring);

std::vectorindices = mapbox::earcut(polygon);

if(numexteriorringpoints==4)

qdebug()<<"exteriorringpointscount interiorringscount"<<<

//qdebug()<<"indices"<

//增加索引號

if (countoffset > 0)

std::for_each(indices.begin(), indices.end(), [&countoffset](auto& value) );

for(int i = 0 ;i indicess.push_back(indices[i]);

countoffset += polygonpointscount;

featuredesc.vecvex.push_back(polygonpointscount);//點數

featuredesc.vecidx.push_back(indices.size());//索引數

}qdebug()<<"polycnt"<

//傳送到gpu

vbo->create();

vbo->bind();

vbo->allocate(&verticess[0],verticess.size()*4);

qopenglvertexarrayobject::binder vaobind(vao);

int offset=0;

//分段存索引

//for(int j=0;j<1;j++)

for(int j=0;j

featuredesc.type = 6 ;

featuredesc.indexcnt = indicess.size();

featuredesc.vexcnt = verticess.size();

featuredesc.vao = vao;

featuredesc.vbo = vbo;

featuredesc.ebo = ebo;

featuredesc.shader = &polygonshader;

glvertexattribpointer(0, 2, gl_float, gl_false, 5 * sizeof(float), (void*)0);

glenablevertexattribarray(0);

glvertexattribpointer(1, 3, gl_float, gl_false, 5 * sizeof(float), (void*)(2 * sizeof(float)));

glenablevertexattribarray(1);

vbo->release();

return true;

}

資料預處理(四) 處理連續型特徵

將連續型特徵轉換為分類特徵,主要包括二值化與分段兩種。設定閾值,將特徵值劃分為0或1,在只考慮某種現象有無出現時可以進行該操作。可以使用sklearn.preprocessing.binarizer進行資料二值化。from sklearn.preprocessing import binarizer...

SpringMVC的學習(四) 處理靜態資源

需要注意一種,dispatcherservlet攔截資源設定成了 是不會攔截jsp資源,但是它會攔截其他靜態資源,例如 html js 等等,那麼我們在使用jsp內部新增 靜態資源就無法成功,所以,我們需要單獨處理下靜態資源 處理方案 在springmvc的配置檔案中新增mvc命名空間下的標籤 修改...

SpringMVC 學習筆記(四) 處理模型資料

目標方法的返回值可以是 modelandview 型別。其中可以包含檢視和模型資訊 springmvc 會把 modelandview 的 model 中資料放入到 request 域物件中.return testmodelandview public modelandview testmodela...