-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathDigitizer.cpp
More file actions
45 lines (39 loc) · 1.27 KB
/
Digitizer.cpp
File metadata and controls
45 lines (39 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "stdafx.h"
#include "Digitizer.h"
#include "ShapeEditor.h"
#include "EditorHelper.h"
#include "ShapefileHelper.h"
// ************************************************************
// Start
// ************************************************************
void Digitizer::StartNewBoundShape(CShapeEditor* editor, ShpfileType shpType, IShapeDrawingOptions* options, long layerHandle)
{
if (!editor || layerHandle == -1) return;
editor->Clear();
editor->put_ShapeType(shpType);
editor->put_LayerHandle(layerHandle);
editor->put_EditorState(esDigitize);
editor->CopyOptionsFrom(options);
return;
}
// ************************************************************
// OnMouseDown
// ************************************************************
bool Digitizer::OnMouseDown(CShapeEditor* editor, double projX, double projY, bool ctrl)
{
if (!editor) return false;
// add another point
editor->HandleProjPointAdd(projX, projY);
editor->SetRedrawNeeded(rtShapeEditor);
// for point layer save the new shape at once
if (EditorHelper::GetShapeType2D(editor) == SHP_POINT)
{
return editor->TryStop();
}
else if (ctrl)
{
// if an attempt to finish a multipoint shape
return editor->TryStop();
}
return true;
}