SASGIS

Веб-картография и навигация


View Revisions: Issue #1947 All Revisions ] Back to Issue ]
Summary 0001947: Импорт точек с одинаковыми названиями и координатами
Revision 06-06-2013 14:10 by vdemidov
Additional Information
Revision 06-06-2013 14:07 by vdemidov
Additional Information Поскольку у меня это изменение не сохранено отдельным коммитом, вот его дифф:
u_MarkDbSml.pas

@@ -581,6 +581,17 @@
   VResult: IMark;
   VMinCount: Integer;
   VMaxCount: Integer;
+ //---
+ VEnumId: IEnumID;
+ AId: Integer;
+ VCnt: Cardinal;
+ VMarkId: IMarkId;
+ VMark: IMark;
+ VMarkNew: IMark;
+ AddMark: Boolean;
+ VTmpPoint: IMarkPoint;
+ //FF: TextFile;
+ //---
 begin
   Result := nil;
   if ANewMarkList <> nil then begin
@@ -607,7 +618,12 @@
         VResult := _UpdateMark(VOld, VNew);
         Result.Add(VResult);
       end;
- for i := VMinCount to VMaxCount - 1 do begin
+ Randomize;
+ ShortDateFormat := 'yyyymmdd';
+ //AssignFile(FF,'./debugmarks-'+DateTostr(Date)+IntToStr(random(10000))+'.log');
+ //ReWrite(FF);
+ for i := VMinCount to VMaxCount - 1 do begin
+ AddMark:=True;
         VOld := nil;
         if (AOldMarkList <> nil) and (i < AOldMarkList.Count) then begin
           VOld := AOldMarkList[i];
@@ -616,9 +632,37 @@
         if (i < ANewMarkList.Count) then begin
           VNew := ANewMarkList[i];
         end;
- VResult := _UpdateMark(VOld, VNew);
- if i < Result.Capacity then begin
- Result.Add(VResult);
+ //TODO: insert check (Robbi)
+ //--------------------------
+ LockRead;
+ try
+ VEnumId := FMarkList.GetIDEnum;
+ if Supports(FMarkList.GetByID(AId), IMarkPoint, VTmpPoint) then begin
+ while VEnumId.Next(1, AId, VCnt) = S_OK do begin
+ if Supports(FMarkList.GetByID(AId), IMark, VMark) and Supports(VNew, IMark, VMarkNew) then begin
+ if Trim(VMark.Name)<>Trim(VMarkNew.Name) then begin
+ //write(FF,'<>'+VMark.Name + ' - '+ VMarkNew.Name);
+ //WriteLn(FF);
+ Continue;
+ end;
+ //Write(FF,'=='+VMark.Name + ' ');
+ if VMark.LLRect.Left+VMark.LLRect.Top-VMarkNew.LLRect.Left-VMarkNew.LLRect.Top<0.00001 then begin
+ //Write(FF,FloatToStr(VMark.LLRect.Left+VMark.LLRect.Top-VMarkNew.LLRect.Left-VMarkNew.LLRect.Top));
+ //WriteLn(FF);
+ AddMark:=False;
+ Break;
+ end;
+ end;
+ end;
+ end;
+ finally
+ UnlockRead;
+ end;
+ if AddMark then begin
+ VResult := _UpdateMark(VOld, VNew);
+ if i < Result.Capacity then begin
+ Result.Add(VResult);
+ end;
         end;
       end;
     finally



Copyright © 2007 - 2024 SAS.Planet Team