* Added X/Y boundaries

This commit is contained in:
Andreas Schneider 2015-05-11 19:30:23 +02:00
parent ffd0cc1028
commit 609ff53253
4 changed files with 289 additions and 102 deletions

View File

@ -18,7 +18,7 @@
<UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/>
<MinorVersionNr Value="7"/>
<BuildNr Value="257"/>
<BuildNr Value="260"/>
<StringTable CompanyName="AKS DataBasis" FileDescription="UO CentrED" InternalName="CentrED" LegalCopyright="(c) 2015 Andreas Schneider and StaticZ" OriginalFilename="CentrED.exe" ProductName="CentrED" ProductVersion="0.7.0"/>
</VersionInfo>
<BuildModes Count="7">
@ -371,6 +371,7 @@
<Filename Value="Tools/UfrmBoundaries.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmBoundaries"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit8>
<Unit9>
@ -474,6 +475,7 @@
<Filename Value="Tools/UfrmToolWindow.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmToolWindow"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit28>
<Unit29>

View File

@ -1,47 +1,64 @@
inherited frmBoundaries: TfrmBoundaries
Left = 290
Left = 1831
Height = 164
Top = 171
Width = 205
Top = 239
Width = 402
Caption = 'Boundaries'
ClientHeight = 164
ClientWidth = 205
object lblMaxZ: TLabel[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = seMaxZ
AnchorSideTop.Side = asrCenter
Left = 8
Height = 16
Top = 89
Width = 68
BorderSpacing.Left = 8
Caption = 'Maximum Z:'
Layout = tlCenter
ParentColor = False
end
object lblMinZ: TLabel[1]
ClientWidth = 402
OnCreate = FormCreate
object gbZRestriction: TGroupBox[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 4
Height = 156
Top = 4
Width = 196
BorderSpacing.Left = 4
BorderSpacing.Top = 4
Caption = 'Restrict Height'
ClientHeight = 141
ClientWidth = 192
TabOrder = 0
object lblMinZ: TLabel
AnchorSideLeft.Control = tbMinZ
AnchorSideTop.Control = seMinZ
AnchorSideTop.Side = asrCenter
Left = 8
Height = 16
Top = 12
Width = 67
BorderSpacing.Left = 8
Left = 4
Height = 13
Top = 8
Width = 68
Caption = 'Minimum Z:'
Layout = tlCenter
ParentColor = False
end
object tbMinZ: TTrackBar[2]
AnchorSideLeft.Control = Owner
object seMinZ: TSpinEdit
AnchorSideTop.Control = gbZRestriction
AnchorSideRight.Control = gbZRestriction
AnchorSideRight.Side = asrBottom
Left = 136
Height = 21
Top = 4
Width = 52
Anchors = [akTop, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 4
MaxValue = 127
MinValue = -128
OnChange = seMinZChange
TabOrder = 0
Value = -128
end
object tbMinZ: TTrackBar
AnchorSideLeft.Control = gbZRestriction
AnchorSideTop.Control = seMinZ
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Control = gbZRestriction
AnchorSideRight.Side = asrBottom
Left = 8
Left = 4
Height = 36
Top = 41
Width = 189
Top = 29
Width = 184
Frequency = 10
Max = 127
Min = -128
@ -49,19 +66,47 @@ inherited frmBoundaries: TfrmBoundaries
PageSize = 1
Position = -128
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 8
TabOrder = 0
BorderSpacing.Around = 4
TabOrder = 1
end
object tbMaxZ: TTrackBar[3]
AnchorSideLeft.Control = Owner
object lblMaxZ: TLabel
AnchorSideLeft.Control = tbMaxZ
AnchorSideTop.Control = seMaxZ
AnchorSideTop.Side = asrCenter
Left = 4
Height = 13
Top = 73
Width = 71
Caption = 'Maximum Z:'
Layout = tlCenter
ParentColor = False
end
object seMaxZ: TSpinEdit
AnchorSideTop.Control = tbMinZ
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = seMinZ
AnchorSideRight.Side = asrBottom
Left = 136
Height = 21
Top = 69
Width = 52
Anchors = [akTop, akRight]
MaxValue = 127
MinValue = -128
OnChange = seMaxZChange
TabOrder = 2
Value = 127
end
object tbMaxZ: TTrackBar
AnchorSideLeft.Control = gbZRestriction
AnchorSideTop.Control = seMaxZ
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Control = gbZRestriction
AnchorSideRight.Side = asrBottom
Left = 8
Left = 4
Height = 36
Top = 118
Width = 189
Top = 94
Width = 184
Frequency = 10
Max = 127
Min = -128
@ -69,41 +114,130 @@ inherited frmBoundaries: TfrmBoundaries
PageSize = 1
Position = 127
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 8
TabOrder = 1
BorderSpacing.Around = 4
TabOrder = 3
end
object seMaxZ: TSpinEdit[4]
AnchorSideTop.Control = tbMinZ
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 149
Height = 25
Top = 85
Width = 48
Anchors = [akTop, akRight]
BorderSpacing.Right = 8
MaxValue = 127
MinValue = -128
OnChange = seMaxZChange
TabOrder = 2
Value = 127
end
object seMinZ: TSpinEdit[5]
object gbViewRestriction: TGroupBox[1]
AnchorSideLeft.Control = gbZRestriction
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 149
Height = 25
Top = 8
Width = 48
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 204
Height = 156
Top = 4
Width = 194
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 4
Caption = 'Restrict View Range'
ClientHeight = 141
ClientWidth = 190
TabOrder = 1
object seMinX: TSpinEdit
AnchorSideLeft.Control = lblX
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = seMaxX
Left = 19
Height = 21
Top = 4
Width = 74
BorderSpacing.Left = 4
OnChange = seMinXChange
TabOrder = 0
end
object seMaxX: TSpinEdit
AnchorSideTop.Control = gbViewRestriction
AnchorSideRight.Control = gbViewRestriction
AnchorSideRight.Side = asrBottom
Left = 112
Height = 21
Top = 4
Width = 74
Anchors = [akTop, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 4
OnChange = seMaxXChange
TabOrder = 1
end
object seMinY: TSpinEdit
AnchorSideLeft.Control = seMinX
AnchorSideTop.Control = seMinX
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = seMinX
AnchorSideRight.Side = asrBottom
Left = 19
Height = 21
Top = 33
Width = 74
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
BorderSpacing.Right = 8
MaxValue = 127
MinValue = -128
OnChange = seMinZChange
OnChange = seMinYChange
TabOrder = 2
end
object seMaxY: TSpinEdit
AnchorSideLeft.Control = seMaxX
AnchorSideTop.Control = seMinY
AnchorSideRight.Control = seMaxX
AnchorSideRight.Side = asrBottom
Left = 112
Height = 21
Top = 33
Width = 74
Anchors = [akTop, akLeft, akRight]
OnChange = seMaxYChange
TabOrder = 3
Value = -128
end
object lblX: TLabel
AnchorSideLeft.Control = gbViewRestriction
AnchorSideTop.Control = seMinX
AnchorSideTop.Side = asrCenter
Left = 4
Height = 13
Top = 8
Width = 11
BorderSpacing.Left = 4
Caption = 'X:'
ParentColor = False
end
object lblY: TLabel
AnchorSideLeft.Control = lblX
AnchorSideTop.Control = seMinY
AnchorSideTop.Side = asrCenter
Left = 4
Height = 13
Top = 37
Width = 10
Caption = 'Y:'
ParentColor = False
end
object lblXSep: TLabel
AnchorSideLeft.Control = seMinX
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = seMaxX
AnchorSideTop.Side = asrCenter
Left = 97
Height = 13
Top = 8
Width = 11
BorderSpacing.Left = 4
Caption = '—'
ParentColor = False
end
object lblYSep: TLabel
AnchorSideLeft.Control = lblXSep
AnchorSideTop.Control = seMinY
AnchorSideTop.Side = asrCenter
Left = 97
Height = 13
Top = 37
Width = 11
Caption = '—'
ParentColor = False
end
end
inherited tmClose: TTimer[2]
end
end

View File

@ -21,7 +21,8 @@
* CDDL HEADER END
*
*
* Portions Copyright 2009 Andreas Schneider
* Portions Copyright 2015 Andreas Schneider
* Portions Copyright 2015 StaticZ
*)
unit UfrmBoundaries;
@ -38,13 +39,28 @@ type
{ TfrmBoundaries }
TfrmBoundaries = class(TfrmToolWindow)
gbZRestriction: TGroupBox;
gbViewRestriction: TGroupBox;
lblYSep: TLabel;
lblXSep: TLabel;
lblY: TLabel;
lblX: TLabel;
lblMaxZ: TLabel;
lblMinZ: TLabel;
seMaxZ: TSpinEdit;
seMinZ: TSpinEdit;
tbMinZ: TTrackBar;
seMinX: TSpinEdit;
seMaxX: TSpinEdit;
seMinY: TSpinEdit;
seMaxY: TSpinEdit;
tbMaxZ: TTrackBar;
tbMinZ: TTrackBar;
procedure FormCreate(Sender: TObject);
procedure seMaxXChange(Sender: TObject);
procedure seMaxYChange(Sender: TObject);
procedure seMaxZChange(Sender: TObject);
procedure seMinXChange(Sender: TObject);
procedure seMinYChange(Sender: TObject);
procedure seMinZChange(Sender: TObject);
procedure tbMaxZChange(Sender: TObject);
procedure tbMinZChange(Sender: TObject);
@ -62,12 +78,43 @@ uses
{ TfrmBoundaries }
procedure TfrmBoundaries.FormCreate(Sender: TObject);
begin
seMinX.MaxValue := frmMain.Landscape.CellWidth - 1;
seMaxX.MaxValue := seMinX.MaxValue;
seMaxX.Value := seMaxX.MaxValue;
seMinY.MaxValue := frmMain.Landscape.CellHeight - 1;
seMaxY.MaxValue := seMinY.MaxValue;
seMaxY.Value := seMaxX.MaxValue;
end;
procedure TfrmBoundaries.seMaxXChange(Sender: TObject);
begin
frmMain.InvalidateFilter;
end;
procedure TfrmBoundaries.seMaxYChange(Sender: TObject);
begin
frmMain.InvalidateFilter;
end;
procedure TfrmBoundaries.seMaxZChange(Sender: TObject);
begin
tbMaxZ.Position := seMaxZ.Value;
frmMain.InvalidateFilter;
end;
procedure TfrmBoundaries.seMinXChange(Sender: TObject);
begin
frmMain.InvalidateFilter;
end;
procedure TfrmBoundaries.seMinYChange(Sender: TObject);
begin
frmMain.InvalidateFilter;
end;
procedure TfrmBoundaries.seMinZChange(Sender: TObject);
begin
tbMinZ.Position := seMinZ.Value;

View File

@ -37,7 +37,7 @@ uses
LCLIntf, UOverlayUI, UStatics, UEnhancedMemoryStream, ActnList,
XMLPropStorage, ImagingClasses, dateutils, UPlatformTypes, UMap, UPacket,
UGLFont, DOM, XMLRead, XMLWrite, strutils, ULightManager, heContnrs,
UContnrExt, UTiledata;
UContnrExt, UTiledata, Types;
type
TAccessChangedListener = procedure(AAccessLevel: TAccessLevel) of object;
@ -2833,7 +2833,11 @@ begin
begin
blockInfo^.State := ssNormal;
if (blockInfo^.Item.Z < frmBoundaries.tbMinZ.Position) or
(blockInfo^.Item.Z > frmBoundaries.tbMaxZ.Position) then
(blockInfo^.Item.Z > frmBoundaries.tbMaxZ.Position) or
(blockInfo^.Item.X < frmBoundaries.seMinX.Value) or
(blockInfo^.Item.X > frmBoundaries.seMaxX.Value) or
(blockInfo^.Item.Y < frmBoundaries.seMinY.Value) or
(blockInfo^.Item.Y > frmBoundaries.seMaxY.Value) then
begin
blockInfo^.State := ssFiltered;
end else