Jump to content

Linuxuser1234

Members
  • Content Count

    65
  • Joined

  • Last visited

Posts posted by Linuxuser1234


  1. trying to get shapefiles to display on a TSphere Component  in BOLT.pas(UNIT 1/Form1) from GISEngine.pas 

    i tried this  

    function TGISEngine.RenderShp: boolean;
    begin
    GISobj.Viewport3D1.Parent := Earth;
    end;

    but that doesnt do anything here is the full unit 

    unit GISEngine;
    //thank you  programmerdelphi2k for helping 
    //This unit Displays Shapefiles onto a 3D Globe
    interface
    uses
      System.SysUtils,
      System.Classes,
      FMX.Viewport3D,
      FMX.Objects3D,
      System.IOUtils,
      System.Generics.Collections,
      BOLT;
    
    type
      TGISFilesnamesSHP = TArray<string>;
      TGISEngine = class
      private
        FFilenames : TList<string>;
        Viewport3D1: TViewport3D;
        Earth:       TSphere;
    
        function GetFilename(const i: integer): string;
      public
        constructor Create; overload;
        constructor Create(const AFilenames: TGISFilesnamesSHP); overload;
        destructor Destroy; override;
        procedure AddFilenames(const AFilenames: TGISFilesnamesSHP);
        procedure ClearFilenames;
        function CountFilenames: integer;
        function RenderShp: boolean;
        property Filename[const i: integer]: string read GetFilename;
        property Filenames: TList<string> read FFilenames;
        function VerifyIfAllFilesSHPExists(out AErrors: TGISFilesnamesSHP): boolean;
        function LoadFilenames: boolean;
        property GISViewport3D: TViewport3D read Viewport3D1 write Viewport3D1;
        property GISEarth: TSphere read Earth write Earth;
      end;
     var
     GISobj : TGISEngine;
     Form1: TForm1;
    implementation
    { TGISEngine }
    
    constructor TGISEngine.Create;
    begin
      Viewport3D1 := TViewport3D.Create(nil);
      Earth      := TSphere.Create(nil);
      FFilenames  := TList<string>.Create;
    end;
    
    constructor TGISEngine.Create(const AFilenames: TGISFilesnamesSHP);
    begin
      Create;
      AddFilenames(AFilenames);
    end;
    
    destructor TGISEngine.Destroy;
    begin
      FFilenames.Free;
      Earth.Free;
      Viewport3D1.Free;
      inherited;
    end;
    
    function TGISEngine.GetFilename(const i: integer): string;
    begin
      result := '';
      if (i > -1) and (i < FFilenames.Count) then
        result := FFilenames.Items[i];
    end;
    
    
    procedure TGISEngine.ClearFilenames;
    begin
      FFilenames.Clear;
    end;
    
    function TGISEngine.CountFilenames: integer;
    begin
      result := FFilenames.Count;
    end;
    procedure TGISEngine.AddFilenames(const AFilenames: TGISFilesnamesSHP);
    var F: string;
    begin
      if (Length(AFilenames) > 0 ) then
        for F in AFilenames do
          if not FFilenames.Contains(F) then
          FFilenames.Add(F);
    end;
    
    function TGISEngine.VerifyIfAllFilesSHPExists(out AErrors: TGISFilesnamesSHP): boolean;
    var
    F: string;
    begin
      result := false;
      if (FFilenames.Count = 0) then
        begin
          AErrors := ['Filenames list is empty'];
          exit;
        end;
      for  F in FFilenames do
        if not FileExists(F) then
          AErrors := AErrors + [F + ', dont exists!'];
    end;
    
    function TGISEngine.LoadFilenames: boolean;
    var F: string;
    begin
      result := false;
      if (FFilenames.Count > 0) then
        begin
        for F in Filenames do
        GISobj.AddFilenames(['tl_2021_01001_roads.shp','world-administrative-boundaries.shp']);
    end;
    end;
    
    function TGISEngine.RenderShp: boolean;
    begin
    GISobj.Viewport3D1.Parent := Earth;
    end;
    
    initialization
    GISobj := TGISEngine.Create;
    finalization
    GISobj.Free;
    end.

     


  2. Im trying to communicate with a component in Unit1 from Unit4  but when i click on the button i get a access violation error how can i resolve this 

     

    procedure TForm4.Button1Click(Sender: TObject);
    var
    Label21: Tlabel;
    Button1: Boolean;
    ProgressBar1 : TProgressBar;
    begin
    //
    ProgressBar1.Visible := True; //Component is in Unit1 (Bolt)
    end;

     

    Screenshot 2023-01-06 093210.png


  3. Do you want to add the selected from ComboEdit1 to the dropdown of ComboEdit2?

     

    Hook Combo1Edit.OnSelect

    procedure TForm4.ComboEdit1OnSelect(Sender: TObject);
    begin         
      ComboEdit2.Items.Add(ComboEdit1.Text);
    end;

    This event is called when an item is selected from the dropped down list of ComboEdit1.
    Naturally, you need to add code to see if the item has already been added before you add it.

    @Lars Fosdal that doesnt work


  4. Im trying make a procedure that when you select an item from ComboEdit1 (it will officially list items from a ftp site) but for a test im 

    trying to list the same item from ComboEdit1 to ComboEdit2 

    procedure TForm4.ComboEdit1Click(Sender: TObject);
    begin         
    
    end;

    i have tried %s like ComboEdit2.Items.Add('%S'); but that doesnt work  

    here is the list items for ComboEdit1 and i havent been able to find code examples 

    TTUL	 	
    TTPA	 	
    TSTL	 	 
    TSLC	 	 
    TSJU	 	 
    TSDF	 	 
    TRDU	 	 
    TPIT	 	 
    TPHX	 	 
    TPHL	 	 
    TPBI	 	 
    TORD	 	 
    TOKC	 	 
    TMSY	 	
    TMSP	 	 
    TMKE	 	 
    TMIA	 	 
    TMEM	 	 
    TMDW	 	 
    TMCO	 	 
    TMCI	 	 
    TLVE	 	 
    TLAS	 	 
    TJUA	 	 
    TJFK	 	 
    TIDS	 	 
    TICH	 	 
    TIAH	 	 
    TIAD	 	 
    THOU	 	 
    TFLL	 	 
    TEWR	 	 
    TDTW	 	 
    TDFW	 	 
    TDEN	 	 
    TDCA	 	 
    TDAY	 	 
    TDAL	 	 
    TCVG	 	 
    TCMH	 	 
    TCLT	 	 
    TBWI	 	 
    TBOS	 	 
    TBNA	 	 
    TATL	 	 
    TADW	 	 
    ROP4	 	 
    ROP3	 	 
    RODN	 	 
    RKSG	 	 
    RKJK	 	 
    PHWA
    PHMO	 	 
    PHKM	 	 
    PHKI	 	 
    PGUA	 	 
    PAPD	 	 
    PAKC	 	 
    PAIH	 	 
    PAHG	 	 
    PAEC	 	 
    PACG	 	 
    PABC	 	 
    NOP4	 	 
    NOP3	 	 
    KYUX	 	 
    KVWX	 	 
    KVTX	 	 
    KVNX	 	 
    KVBX	 	 
    KVAX	 	 
    KUEX	 	 
    KUDX	 	 
    KTYX	 	 
    KTWX	 	 
    KTLX	 	 
    KTLH	 	 
    KTFX	 	 
    KTBW	 	 
    KSRX	 	 
    KSOX	 	 
    KSJT	 	 
    KSHV	 	 
    KSGF	 	 
    KSFX	 	 
    KRTX	 	 
    KRLX	 	 
    KRIW	 	
    KRGX	 	 
    KRAX	 	 
    KPUX	 	 
    KPOE	 	 
    KPDT	 	 
    KPBZ	 	 
    KPAH	 	 
    KOTX	 	
    KOKX	 	 
    KOHX	 	 
    KOAX	 	 
    KNQA	 	 
    KNKX	 	 
    KMXX	 	 
    KMVX	 	 
    KMUX	 	 
    KMTX	 	 
    KMSX	 	 
    KMRX	 	 
    KMQT	 	 
    KMPX	 	 
    KMOB	 	 
    KMLB	 	 
    KMKX	 	 
    KMHX	 	 
    KMBX	 	 
    KMAX	 	 
    KMAF	 	 
    KLZK	 	 
    KLWX	 	 
    KLVX	 	 
    KLTX	 	 
    KLSX	 
    KLRX
    KLOT	 
    KLNX	
    KLIX	 	 
    KLGX
    KLCH
    KLBB	 	 
    KJKL	 	 
    KJGX
    KJAX	 	 
    KIWX	
    KIWA	 	 
    KINX	 	 
    KIND
    KILX	 	 
    KILN	 	
    KICX	 	
    KICT	 	 
    KHTX	 	 
    KHPX	 	 
    KHNX	 	 
    KHGX	 	 
    KHDX	 	 
    KGYX	 	 
    KGWX	 	 
    KGSP	 	 
    KGRR	 	 
    KGRK	 	 
    KGRB	 	 
    KGLD	 	 
    KGJX	 	 
    KGGW	 	 
    KFWS	 	 
    KFTG	 	 
    KFSX	 	 
    KFSD	 	 
    KFFC	 	 
    KFDX	 	 
    KFDR	 	 
    KFCX	 	 
    KEYX	 	 
    KEWX	 	 
    KEVX	 	 
    KESX	 	 
    KEPZ	 	 
    KEOX	 	 
    KENX	 	 
    KEMX	 	 
    KEAX	 	 
    KDYX	 	 
    KDVN	 	 
    KDTX	 	 
    KDOX	 	 
    KDMX	 	 
    KDLH	 	 
    KDIX	 	 
    KDGX	 	 
    KDFX	 	 
    KDDC	 	 
    KDAX	 	 
    KCYS	 	 
    KCXX	 	 
    KCRP	 	 
    KCLX	 	 
    KCLE	 	 
    KCCX	 	 
    KCBX	 	 
    KCBW	 	 
    KCAE	 	 
    KBYX	 	 
    KBUF	 	 
    KBRO	 	 
    KBOX	 	 
    KBMX	 	 
    KBLX	 	 
    KBIS	 	 
    KBHX	 	
    KBGM	 	 
    KBBX	 	 
    KATX	 	 
    KARX	 	
    KAPX	 	 
    KAMX	 	 
    KAMA	 	 
    KAKQ	 	 
    KABX	 	 
    KABR	 	 
    FOP1	 	 
    DOP1	 	 
    DAN1

     


  5. @programmerdelphi2k also do you know how to set the TCalloutpanel visibilaty to true when you click on the earth

    im trying to do this 

    procedure TForm1.Button22Click(Sender: TObject);
    var
    Marker : TCalloutPanel;
    Coord: TLabel;
    MarkerBool: Boolean;
    begin
    if MarkerBool then begin
      Marker := TCalloutPanel.Create(Self);
      Marker.Width := 209;
      Marker.Height := 41;
      Marker.RotationAngle := 180;
      Marker.Visible := False;
      Marker.Parent := Self;
      Coord := TLabel.Create(Self);
      Coord.Width := 120;
      Coord.Visible := False;
      Coord.Parent := Self;
      Coord.Height:= 17;
      Coord.Text := '00.00000 -00.00000';
    end else begin
    Earth.OnClick := Marker.Visible:=True; //<--Code Doesnt work keep getting incompatible types TNotiftEvent and procedure untyped pointer or untyped parameter

     


  6. Im trying to get TCalloutPanel to follow the mouse pointer but i cant find any code examples on this here is the code i have so far 

    procedure TForm1.Button22Click(Sender: TObject);
    var
    Marker : TCalloutPanel;
    begin
    //
    Marker := TCalloutPanel.Create(Self);
    Marker.Width := 209;
    Marker.Height := 41;
    Marker.RotationAngle := 180;
    Marker.Visible := True;
    Marker.Parent := Self;
    end;

     


  7. @programmerdelphi2k i keep getting Type BOLT (which is my unit1 or TForm1) is not yet completely defined  and i have been unable to resolve the error and yes i have looked at the docwiki 

    unit GISEngine;
    //This unit Displays Shapefiles onto a 3D Globe
    interface
    uses
    System.SysUtils,
    System.Classes,
    BOLT,
    FMX.Viewport3D;
    type
    BOLT = class(BOLT)
    Viewport3D1:TViewport3D;
    procedure VP3DGISEngine(Sender: TObject);
    private
    public
    end;
    var
    Form1 : TForm1;
    implementation
    
    end.

     


  8. I have a unit called BOLT and i would like to use the viewport component from that unit to my GISEngine unit how can i do this?

    unit GISEngine;
    interface
    uses
    System.SysUtils,
    System.Classes,
    BOLT,
    FMX.Viewport3D;
    implementation
    procedure TForm1.Viewport3D1(Sender: TObject);
    begin
    
    end;
    end.

    Error GISEngine does not contain a member named Viewport3D1


  9. @Rollo62 

    now i get this and also when i click on the design tab i keep getting a error saying container form not set and i changed the name from ignore the first error i got it fixed but im still getting the second error 

    
    //second error line  
    LIdx := AAngle div 15.0;

    169581054_Screenshot2022-11-09101451.thumb.png.09042df136faeff2b98dfa0ce7ae990b.png


  10. @Rollo62 i put the function under public still wont work 

      private
        { Private declarations }
      public
        { Public declarations }
    
       function TForm7.KnobLabelStationAngle(const AAngle : Single) : String; overload;
       function TForm7.KnobLabelFreqAngle(const AAngle : Single ) : Single; overload;
      end;
    
    procedure TForm7.KnobClick(Sender: TObject);
    begin
    //Knob
    Knob.RotationAngle := Knob.RotationAngle - 15.0;
    Rectangle4.RotationAngle := Knob.RotationAngle - 15.0;
    Label2.Text := Format ('%s',
                          [KnobLabelStationAngle(Knob.RotationAngle), KnobLabelFreqAngle(Knob.RotationAngle) ] );
    end;
    function TForm7.KnobLabelStationAngle(const AAngle : Single) : String;
    const
    CStationLabel : array[0..24-1] of String = ('KEC61', 'WXK30');
    var
    LIdx : Integer;
    begin
    LIdx := AAngle div 15.0;
    Result := CStationLabel[LIdx];
    end;
    function TForm7.KnobLabelFreqAngle(const AAngle : Single ) : Single;
    begin
      Result := (AAngle / 162.550 * 162.525 * 162.500  * 162.400 * 162.475)
    end;

    900891737_Screenshot2022-11-09091445.thumb.png.3772e33544fadd282ae42e107fb8aeb9.png

×