*** empty log message ***
@@ -108,6 +108,7 @@ | ||
108 | 108 | annotation->location.y = |
109 | 109 | worldLastMousePosition.y + selp->offset[1] * div; |
110 | 110 | } |
111 | + Refresh(); | |
111 | 112 | } |
112 | 113 | } |
113 | 114 | }else{ |
@@ -225,6 +226,9 @@ | ||
225 | 226 | if(sel->isSelected() && emgr->isGrabItems()){ |
226 | 227 | dmgr->push_back( |
227 | 228 | hpl::aleph::map::ActionType::Move, *sel); |
229 | +#ifdef __WXDEBUG__ | |
230 | +// hpl::error::caution("undo index=%d", dmgr->getIndex()); | |
231 | +#endif | |
228 | 232 | } |
229 | 233 | if(sel->isSelectOneObject()){ |
230 | 234 | //オブジェクトを選択していたら |
@@ -389,11 +393,12 @@ | ||
389 | 393 | } |
390 | 394 | } |
391 | 395 | |
396 | + /* | |
392 | 397 | if(sel->isSelected()){ |
393 | 398 | //コピペ情報登録 |
394 | 399 | wxGetApp().getDoneHistoryManager()->push_back(hpl::aleph::map::ActionType::Move, *sel); |
395 | 400 | } |
396 | - | |
401 | + */ | |
397 | 402 | //離した |
398 | 403 | emgr->setGrabItems(false); |
399 | 404 | } |
@@ -829,13 +834,13 @@ | ||
829 | 834 | //this->polyPropDialog.updateCombo(); |
830 | 835 | |
831 | 836 | //ポリゴン・線のFixを行う |
832 | - for(int i = 0; i < LineList.size(); i ++){ | |
837 | + for(int i = 0; i < (int)LineList.size(); i ++){ | |
833 | 838 | if(smgr->isDeleteLine(i)){ |
834 | 839 | continue; |
835 | 840 | } |
836 | 841 | hpl::aleph::map::fixLine(i, smgr); |
837 | 842 | } |
838 | - for(int i = 0; i < PolygonList.size(); i ++){ | |
843 | + for(int i = 0; i < (int)PolygonList.size(); i ++){ | |
839 | 844 | if(smgr->isDeletePolygon(i)){ |
840 | 845 | continue; |
841 | 846 | } |
@@ -103,7 +103,7 @@ | ||
103 | 103 | int my = ev.m_y; |
104 | 104 | |
105 | 105 | //アンドゥ情報に追加しておきます |
106 | - hpl::aleph::map::HPLDoneHistory* hmgr = wxGetApp().getDoneHistoryManager(); | |
106 | +// hpl::aleph::map::HPLDoneHistory* hmgr = wxGetApp().getDoneHistoryManager(); | |
107 | 107 | sel->setMousePosition(mx, my); |
108 | 108 | hpl::aleph::HPLEventManager* emgr = wxGetApp().getEventManager(); |
109 | 109 |
@@ -221,46 +221,69 @@ | ||
221 | 221 | hpl::aleph::map::HPLDoneHistory* dmgr = wxGetApp().getDoneHistoryManager(); |
222 | 222 | hpl::aleph::HPLStockManager* smgr = wxGetApp().getStockManager(); |
223 | 223 | |
224 | - bool result = dmgr->back(&act); | |
225 | - if(result){ | |
226 | - if(act.type == hpl::aleph::map::ActionType::None || | |
227 | - act.type == hpl::aleph::map::ActionType::Move) | |
228 | - { | |
229 | - //移動を元に戻す | |
230 | - for(int i = 0; i < (int)act.selectData.getSelPoints()->size(); i ++){ | |
231 | - int index = act.selectData.getSelPoints()->at(i).index; | |
232 | - endpoint_data* ep = get_endpoint_data(index); | |
233 | - //TODO 削除・追加のUndo機能も実装しよう。 | |
234 | - //これだけだと削除されている場合エラーになる | |
235 | - if(smgr->isDeletePoint(index) || ep == NULL){ | |
236 | - //TODO 応急処置! | |
237 | - continue; | |
224 | + if(dmgr->getIndex() > 0){ | |
225 | + bool result = dmgr->back(&act); | |
226 | + if(!result){ | |
227 | + dmgr->forward(&act); | |
228 | + } | |
229 | + result = dmgr->back(&act); | |
230 | + if(result){ | |
231 | + if(act.type == hpl::aleph::map::ActionType::None || | |
232 | + act.type == hpl::aleph::map::ActionType::Move) | |
233 | + { | |
234 | + //移動を元に戻す | |
235 | + for(int i = 0; i < (int)act.selectData.getSelPoints()->size(); i ++){ | |
236 | + int index = act.selectData.getSelPoints()->at(i).index; | |
237 | + endpoint_data* ep = get_endpoint_data(index); | |
238 | + //TODO 削除・追加のUndo機能も実装しよう。 | |
239 | + //これだけだと削除されている場合エラーになる | |
240 | + if(smgr->isDeletePoint(index) || ep == NULL){ | |
241 | + //TODO 応急処置! | |
242 | + continue; | |
243 | + } | |
244 | + ep->vertex = act.pointVertexMap[index]; | |
238 | 245 | } |
239 | - ep->vertex.x = act.pointVertexMap[index][0]; | |
240 | - ep->vertex.y = act.pointVertexMap[index][1]; | |
241 | - } | |
242 | - for(int i = 0; i < act.selectData.getSelObjects()->size(); i ++){ | |
243 | - int index = act.selectData.getSelObjects()->at(i).index; | |
244 | - if(smgr->isDeleteObject(index) || index >= SavedObjectList.size()){ | |
245 | - continue; | |
246 | + for(int i = 0; i < (int)act.selectData.getSelObjects()->size(); i ++){ | |
247 | + int index = act.selectData.getSelObjects()->at(i).index; | |
248 | + if(smgr->isDeleteObject(index) || index >= (int)SavedObjectList.size()){ | |
249 | + continue; | |
250 | + } | |
251 | + map_object* obj = &SavedObjectList[index]; | |
252 | + obj->location = act.objectLocationMap[index]; | |
246 | 253 | } |
247 | - map_object* obj = &SavedObjectList[index]; | |
248 | - obj->location.x = act.objectLocationMap[index][0]; | |
249 | - obj->location.y = act.objectLocationMap[index][1]; | |
250 | - obj->location.z = act.objectLocationMap[index][2]; | |
254 | + //lines | |
255 | + for(int i = 0; i < (int)act.selectData.getSelLines()->size(); i ++){ | |
256 | + int index = act.selectData.getSelLines()->at(i).index; | |
257 | + line_data* line = get_line_data(index); | |
258 | + for(int j = 0; j < 2; j ++){ | |
259 | + int epIndex = line->endpoint_indexes[j]; | |
260 | + get_endpoint_data(epIndex)->vertex = act.pointVertexMap[epIndex]; | |
261 | + } | |
262 | + } | |
263 | + | |
264 | + //polygons | |
265 | + for(int i = 0; i < (int)act.selectData.getSelPolygons()->size(); i ++){ | |
266 | + int index = act.selectData.getSelPolygons()->at(i).index; | |
267 | + polygon_data* poly = get_polygon_data(index); | |
268 | + for(int j = 0; j < poly->vertex_count; j ++){ | |
269 | + int epIndex = poly->endpoint_indexes[j]; | |
270 | + get_endpoint_data(epIndex)->vertex = act.pointVertexMap[epIndex]; | |
271 | + } | |
272 | + } | |
273 | + | |
274 | + }else{ | |
275 | + hpl::error::halt("This function is disable"); | |
251 | 276 | } |
277 | + | |
252 | 278 | }else{ |
253 | - hpl::error::halt("This function is disable"); | |
279 | + #ifdef __WXDEBUG__ | |
280 | + hpl::error::caution("Undo失敗。index=%d", dmgr->getIndex()); | |
281 | + #endif | |
254 | 282 | } |
255 | 283 | |
256 | - }else{ | |
257 | -#ifdef __WXDEBUG__ | |
258 | - hpl::error::caution("Undo失敗。index=%d", dmgr->getIndex()); | |
259 | -#endif | |
284 | + //更新 | |
285 | + this->updateMapItems(); | |
260 | 286 | } |
261 | - | |
262 | - //更新 | |
263 | - this->updateMapItems(); | |
264 | 287 | } |
265 | 288 | void MapEditorMainFrame::OnRedo(wxCommandEvent& ev) |
266 | 289 | { |
@@ -290,4 +290,6 @@ | ||
290 | 290 | |
291 | 291 | TODO ?I?u?W?F?N?g?lj????? |
292 | 292 | TODO ?I?u?W?F?N?g?̍????ύX???Undo?v?f?ɒlj?????B |
293 | -TODO ?I?u?W?F?N?g?̍????̓|???S???̏????烢?ŗp?? | |
\ No newline at end of file | ||
293 | +TODO ?I?u?W?F?N?g?̍????̓|???S???̏????烢?ŗp?? | |
294 | + | |
295 | +TODO HPLRealMapData?̃C???f?b?N?X?L?????????v???b?g?t?H?[???̋L?? |
@@ -575,7 +575,7 @@ | ||
575 | 575 | isClockwiseNeighbour = false; |
576 | 576 | } |
577 | 577 | if(adjacentPolyIndex != NONE){ |
578 | - if(smgr->delPolygons[adjacentPolyIndex]){ | |
578 | + if(smgr->isDeletePolygon(adjacentPolyIndex)){ | |
579 | 579 | //削除されている |
580 | 580 | adjacentPolyIndex = NONE; |
581 | 581 | if(isClockwiseNeighbour){ |
@@ -605,12 +605,14 @@ | ||
605 | 605 | |
606 | 606 | //自分方向のSideもチェック |
607 | 607 | if(isClockwiseNeighbour){ |
608 | - if(smgr->isDeleteSide(line->counterclockwise_polygon_side_index)){ | |
608 | + if(line->counterclockwise_polygon_side_index != NONE && | |
609 | + smgr->isDeleteSide(line->counterclockwise_polygon_side_index)){ | |
609 | 610 | line->counterclockwise_polygon_side_index = NONE; |
610 | 611 | } |
611 | 612 | poly->side_indexes[i] = line->counterclockwise_polygon_side_index; |
612 | 613 | }else{ |
613 | - if(smgr->isDeleteSide(line->clockwise_polygon_side_index)){ | |
614 | + if(line->clockwise_polygon_side_index != NONE && | |
615 | + smgr->isDeleteSide(line->clockwise_polygon_side_index)){ | |
614 | 616 | line->clockwise_polygon_side_index = NONE; |
615 | 617 | } |
616 | 618 | poly->side_indexes[i] = line->clockwise_polygon_side_index; |
@@ -47,6 +47,10 @@ | ||
47 | 47 | class HPLActionItem{ |
48 | 48 | private: |
49 | 49 | HPLActionItem(){} |
50 | + /** | |
51 | + 点の位置を記憶 | |
52 | + */ | |
53 | + void storePointVertex(int index); | |
50 | 54 | public: |
51 | 55 | /** |
52 | 56 | @param t タイプ ActionType:: |
@@ -59,8 +63,8 @@ | ||
59 | 63 | int type; |
60 | 64 | hpl::aleph::map::HPLSelectData selectData; |
61 | 65 | //位置情報の記録 |
62 | - std::map<int, int[2]> pointVertexMap; | |
63 | - std::map<int, int[3]> objectLocationMap; | |
66 | + std::map<int, world_point2d> pointVertexMap; | |
67 | + std::map<int, world_point3d> objectLocationMap; | |
64 | 68 | hpl::aleph::map::HPLRealMapData realData; |
65 | 69 | }; |
66 | 70 |
@@ -522,7 +522,7 @@ | ||
522 | 522 | bool hpl::aleph::HPLStockManager::isDeletePlatform(int index) |
523 | 523 | { |
524 | 524 | #ifdef _WXDEBUG_ |
525 | - wxASSERT(index >= 0 && index < this->del.size()); | |
525 | + wxASSERT(index >= 0 && index < this->delPlatforms.size()); | |
526 | 526 | #endif |
527 | 527 | return this->delPlatforms[index]; |
528 | 528 | } |
@@ -17,6 +17,15 @@ | ||
17 | 17 | namespace map{ |
18 | 18 | class HPLRealMapData{ |
19 | 19 | private: |
20 | + //TODO インデックスの記憶 | |
21 | + //こぴぺやUndo処理などで必要かもしれない | |
22 | + std::map<int, int> originalPointIndexMap; | |
23 | + std::map<int, int> originalLineIndexMap; | |
24 | + std::map<int, int> originalObjectIndexMap; | |
25 | + std::map<int, int> originalPolygonIndexMap; | |
26 | + std::map<int, int> originalSideIndexMap; | |
27 | + std::map<int, int> originalPlatformIndexMap; | |
28 | + | |
20 | 29 | //点データ<data_structure> |
21 | 30 | std::vector<endpoint_data> realPoints; |
22 | 31 | //オブジェクトデータ |
@@ -27,6 +36,9 @@ | ||
27 | 36 | std::vector<side_data> realSides; |
28 | 37 | //ポリゴンデータ |
29 | 38 | std::vector<polygon_data> realPolygons; |
39 | + | |
40 | + //TODO platform | |
41 | + std::vector<polygon_data> realPlatform; | |
30 | 42 | public: |
31 | 43 | HPLRealMapData(); |
32 | 44 | ~HPLRealMapData(); |
@@ -10,22 +10,58 @@ | ||
10 | 10 | this->realData = real; |
11 | 11 | |
12 | 12 | //現在位置を覚えておきます |
13 | - for(int i = 0; i < sel.getSelPoints()->size(); i ++){ | |
14 | - int index = sel.getSelPoints()->at(i).index; | |
15 | - endpoint_data* ep = get_endpoint_data(index); | |
16 | - this->pointVertexMap[index][0] = ep->vertex.x; | |
17 | - this->pointVertexMap[index][1] = ep->vertex.y; | |
13 | + //points | |
14 | + for(int i = 0; i < (int)sel.getSelPoints()->size(); i ++){ | |
15 | + this->storePointVertex(sel.getSelPoints()->at(i).index); | |
18 | 16 | } |
19 | - for(int i = 0; i < sel.getSelObjects()->size(); i ++){ | |
17 | + | |
18 | + //objects | |
19 | + for(int i = 0; i < (int)sel.getSelObjects()->size(); i ++){ | |
20 | 20 | int index = sel.getSelObjects()->at(i).index; |
21 | +#ifdef __WXDEBUG__ | |
22 | + wxASSERT(index < (int)SavedObjectList.size()); | |
23 | +#endif | |
21 | 24 | map_object* obj = &SavedObjectList[index]; |
22 | - this->objectLocationMap[index][0] = obj->location.x; | |
23 | - this->objectLocationMap[index][1] = obj->location.y; | |
24 | - this->objectLocationMap[index][2] = obj->location.z; | |
25 | + this->objectLocationMap[index] = obj->location; | |
25 | 26 | } |
27 | + | |
28 | + //lines | |
29 | + for(int i = 0; i < (int)sel.getSelLines()->size(); i ++){ | |
30 | + int index = sel.getSelLines()->at(i).index; | |
31 | + line_data* line = get_line_data(index); | |
32 | +#ifdef __WXDEBUG__ | |
33 | + wxASSERT(line); | |
34 | +#endif | |
35 | + for(int j = 0; j < 2; j ++){ | |
36 | + this->storePointVertex(line->endpoint_indexes[j]); | |
37 | + } | |
38 | + } | |
39 | + //polygons | |
40 | + for(int i = 0; i < (int)sel.getSelPolygons()->size(); i ++){ | |
41 | + int index = sel.getSelPolygons()->at(i).index; | |
42 | + polygon_data* poly = get_polygon_data(index); | |
43 | +#ifdef __WXDEBUG__ | |
44 | + wxASSERT(poly); | |
45 | +#endif | |
46 | + for(int j = 0; j < poly->vertex_count; j ++){ | |
47 | + this->storePointVertex(poly->endpoint_indexes[j]); | |
48 | + } | |
49 | + } | |
50 | + | |
26 | 51 | // memcpy(&this->selectData, &sel, sizeof(hpl::aleph::map::HPLSelectData)); |
27 | 52 | // memcpy(&this->realData, &real, sizeof(hpl::aleph::map::HPLRealMapData)); |
28 | 53 | } |
54 | +/** | |
55 | + 点の位置を記憶 | |
56 | +*/ | |
57 | +void hpl::aleph::map::HPLActionItem::storePointVertex(int index) | |
58 | +{ | |
59 | + endpoint_data* ep = get_endpoint_data(index); | |
60 | +#ifdef __WXDEBUG__ | |
61 | + wxASSERT(ep); | |
62 | +#endif | |
63 | + this->pointVertexMap[index] = ep->vertex; | |
64 | +} | |
29 | 65 | hpl::aleph::map::HPLActionItem::~HPLActionItem() |
30 | 66 | { |
31 | 67 | int a = 0; |
@@ -97,10 +133,19 @@ | ||
97 | 133 | bool hpl::aleph::map::HPLDoneHistory::back(hpl::aleph::map::HPLActionItem* act) |
98 | 134 | { |
99 | 135 | if(index < 0){ |
136 | +#ifdef __WXDEBUG__ | |
137 | + hpl::error::caution("undo index=%d cannot undo", index); | |
138 | +#endif | |
100 | 139 | return false; |
101 | 140 | } |
141 | +#ifdef __WXDEBUG__ | |
142 | +// hpl::error::caution("undo back() index=%d", index); | |
143 | +#endif | |
102 | 144 | *act = this->actionList[index]; |
103 | 145 | index --; |
146 | +#ifdef __WXDEBUG__ | |
147 | +// hpl::error::caution("undo back() index=%d", index); | |
148 | +#endif | |
104 | 149 | return true; |
105 | 150 | } |
106 | 151 | bool hpl::aleph::map::HPLDoneHistory::forward(hpl::aleph::map::HPLActionItem* act) |