Nous utilisons des cookies pour vous garantir la meilleure expérience sur notre site. Si vous continuez à utiliser ce dernier, nous considèrerons que vous acceptez l'utilisation des cookies. J'ai compris ! ou En savoir plus !.
banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

Annonce

Printemps des cartes 2024

#1 Tue 25 September 2007 16:51

Jean marie
Participant assidu
Lieu: Moissy Cramayel
Date d'inscription: 15 Feb 2007
Messages: 309
Site web

[STUDIO 2007/2008 et Mapguide] fonction enregistrer sous en dwf

bonjour une petite question ... (hé oui encore wink )

j'ai réalisé une présentation Web sous studio 2008
je paramètre le lien pour que le client visualise la présentation en dwf
je voudrai affecter à un bouton de MAPGUIDE la fonction enregistrer sous
qui est égale aux touches Ctrl+S 

comment personnaliser cette fonction... comme le montre la capture
car le client me demande de pouvoir exploiter de fond de la carte dans son
Autodesk Design Review
... une piste avec la fonction scrip de studio et ensuite ...

Merci à vous
Cordialement Jean-Marie

Dernière modification par Jean marie (Tue 25 September 2007 22:17)


Fichier(s) joint(s) :
Pour accéder aux fichiers vous devez vous inscrire.

Hors ligne

 

#2 Tue 25 September 2007 22:16

Gwenael Bachelot
Participant assidu
Lieu: Bureau Autodesk : Paris 12ème
Date d'inscription: 5 Sep 2005
Messages: 608
Site web

Re: [STUDIO 2007/2008 et Mapguide] fonction enregistrer sous en dwf

Bonsoir Jean Marie,

Dans le sample Sheboygan, il y a un "Plot as DWF" qui fait à peu près ça... en fait il fait bien plus, mais on doit pouvoir lui en faire faire moins ;-)

Cordialement,
Gwenael

Hors ligne

 

#3 Wed 26 September 2007 00:25

Jean marie
Participant assidu
Lieu: Moissy Cramayel
Date d'inscription: 15 Feb 2007
Messages: 309
Site web

Re: [STUDIO 2007/2008 et Mapguide] fonction enregistrer sous en dwf

Merci Gwenael
j'ai cherché sur ta piste et j'ai trouvé en utilisant le sample Sheboygan

1 télécharger le sample shéboygan en php sous le lien suivant nom phpviewersample.zip

http://download.osgeo.org/mapguide/rele … sample.zip

pour mon problème j'ai besoin des éléments suivant dans le fichier zip plot.php et plotmain.php

modif des lignes en gras qui correspondent à ma présentation web et  ma configuration d'impression et j'enrgistre sous des nouveaux répertoires sous www dans c:\..\WebServerExtensions\www\eplotespvert\plot

mon fichier plot.php ***********************************************************
<?php

//
//  Copyright (C) 2004-2006  Autodesk, Inc.
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of version 2.1 of the GNU Lesser
//  General Public License as published by the Free Software Foundation.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//

// This script plots the current view of the map, optionally
// using the Scale parameter if Scale > 0.

include '../utilityfunctions.php';

$mgSessionId = ($_SERVER['REQUEST_METHOD'] == "POST")? $_POST['SESSION']: $_GET['SESSION'];

try
{
    // Initialize the Web Extensions and connect to the erver using
    // the Web Extensions session identifier stored in PHP session state.

    MgInitializeWebTier ($configFilePath);

    $userInfo = new MgUserInformation($mgSessionId);
    $siteConnection = new MgSiteConnection();
    $siteConnection->Open($userInfo);

    $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);

    // Create an instance of ResourceService and use that to open the
    // current map instance stored in session state.

    $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
    $map = new MgMap();
    $map->Open($resourceService, 'plan des espaces verts');

    // Now create an instance of MappingService and use it to plot the
    // current view of the map.

    $dwfVersion = new MgDwfVersion("6.01", "1.2");
    $plotSpec = new MgPlotSpecification(8.5, 11, MgPageUnitsType::Inches);
    $plotSpec->SetMargins(0.5, 0.5, 0.5, 0.5);

    $mappingService = $siteConnection->CreateService(MgServiceType::MappingService);

    $layout = null;
    if (array_key_exists('UseLayout', $_GET) && $_GET['UseLayout'] == 'true')
    {
        $layoutRes = new MgResourceIdentifier("Library://plan des espaces verts/S.I.G - Plan des Espaces Verts.PrintLayout");
        $layout =  new MgLayout($layoutRes, "plan des espaces verts", MgPageUnitsType::Inches);
    }

    $scale = doubleval($_GET['Scale']);
    if ($scale <= 0)
    {
        $byteReader = $mappingService->GeneratePlot($map, $plotSpec, $layout, $dwfVersion);
    }
    else
    {
        $mapCenter = $map->GetViewCenter()->GetCoordinate();
        $byteReader = $mappingService->GeneratePlot($map, $mapCenter, $scale, $plotSpec, $layout, $dwfVersion);
    }

    // Now output the resulting DWF.

    OutputReaderContent($byteReader);
}
catch (MgException $e)
{
    $result = $e->GetMessage() . "<br><br>" . $e->GetDetails();

    header('Content-Type: text/html');
    header('Content-Length: ' . strlen($result));
    echo $result;
}

?>

mon fichier plotmain.php ********************************************************
<?php

//
//  Copyright (C) 2004-2006  Autodesk, Inc.
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of version 2.1 of the GNU Lesser
//  General Public License as published by the Free Software Foundation.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
    <title>Plot Task</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <link rel="stylesheet" href="../styles/gt.css" type="text/css">

    <script language="javascript">
    function Submit()
    {
        var plotForm = document.getElementById("plotForm");
        var scaleValue = document.getElementById("scaleValue");
        var useLayoutValue = document.getElementById("useLayoutValue");
        var useLayoutSelect = document.getElementById("useLayoutSelect");
        if(useLayoutSelect.checked)
            useLayoutValue.value = "true";
        else
            useLayoutValue.value = "false";

        scaleValue.value = "0";
        plotForm.submit();
    }
    function SubmitAtScale()
    {
        var plotForm = document.getElementById("plotForm");
        var scaleValue = document.getElementById("scaleValue");
        var scaleSelect = document.getElementById("scaleSelect");
        var useLayoutValue = document.getElementById("useLayoutValue");
        var useLayoutAtScale = document.getElementById("useLayoutAtScale");
        if(useLayoutAtScale.checked)
            useLayoutValue.value = "true";
        else
            useLayoutValue.value = "false";

        scaleValue.value = scaleSelect.value;
        plotForm.submit();
    }
    </script>
</head>

<body>

<?php
    include '../utilityfunctions.php';

    // Display a couple of forms prompting the user to either
    // plot the current view of the map, or the current view of
    // the map at a specified scale. Submitting one of these forms
    // opens a new window containing an EPlot DWF. The EPlot DWF
    // is generated by the plot.php script.

    $mgSessionId = ($_SERVER['REQUEST_METHOD'] == "POST")? $_POST['SESSION']: $_GET['SESSION'];
    $currentScale = 0;

    try
    {
        // Initialize the Web Extensions and connect to the Server using
        // the Web Extensions session identifier stored in PHP session state.

        MgInitializeWebTier($configFilePath);

        $userInfo = new MgUserInformation($mgSessionId);
        $siteConnection = new MgSiteConnection();
        $siteConnection->Open($userInfo);

        // Create a ReserviceService object and use it to open the Map
        // object from the sessions repository. Use the Map object to
        // determine the current scale of the map for display on this
        // page.

        $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
        $map = new MgMap();
        $map->Open($resourceService, 'plan des espaces verts');

        $viewCenter = $map->GetViewCenter();
        $viewScale = $map->GetViewScale();
    }
    catch (MgException $e)
    {
        echo $e->GetMessage();
        echo $e->GetDetails();
    }
?>

<form id="plotForm" action="plot.php" method="get" target="_blank">
    <input name="SESSION" type="hidden" value="<?php echo $mgSessionId; ?>">
    <input name="Scale" id="scaleValue" type="hidden" value="0">
    <input name="UseLayout" id="useLayoutValue" type="hidden" value="false">
</form>

<table class="RegText" border="0" cellspacing="0" width="100%">
    <tr><td class="Title">&nbsp;Plot as DWF<hr></td></tr>
    <tr><td class="SubTitle">Plot a View of the Map</td></tr>
    <tr><td>View Center X:  <?php printf('%.3f', $viewCenter->GetCoordinate()->GetX()); ?></td></tr>
    <tr><td>View Center Y:  <?php printf('%.3f', $viewCenter->GetCoordinate()->GetY()); ?></td></tr>
    <tr><td class=\"Spacer\"></td></tr>
    <tr><td class=\"Spacer\"></td></tr>
    <tr><td>View Scale:     1:<?php printf('%.0f', $viewScale); ?><hr></td></tr>

    <tr><td class="SubTitle">Plot the Current Map View</td></tr>
    <tr><td class=\"Spacer\"></td></tr>
    <tr><td class=\"Spacer\"></td></tr>
    <tr>
        <td>
            <input class="Ctrl" type="button" onClick="Submit()" value="Plot" style="width:60px">
        </td>
    </tr>
    <tr>
        <td>
            <input class="Ctrl" type="checkbox" id="useLayoutSelect">&nbsp;Use Print Layout<hr>
        </td>
    </tr>

    <tr><td class="SubTitle">Plot at a Specified Scale</td></tr>
    <tr><td class=\"Spacer\"></td></tr>
    <tr><td class=\"Spacer\"></td></tr>
    <tr>
        <td>
            Scale:
            <select size="1" class="Ctrl" id="scaleSelect" style="width:80px">
        <option value="200">1:0,200</option>
        <option value="500">1:0,500</option>

                <option value="1000">1:1,000</option>
                <option value="8000">1:8,000</option>
                <option value="20000">1:20,000</option>
                <option value="25000">1:25,000</option>
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <input class="Ctrl" type="button" onClick="SubmitAtScale()" value="Plot" style="width:60px">
        </td>
    </tr>
    <tr>
        <td>
            <input class="Ctrl" type="checkbox" id="useLayoutAtScale">&nbsp;Use Print Layout
        </td>
    </tr>
</table>

</body>

</html>
****************************************************************************
dans le répertoire ..\WebServerExtensions\www\eplotespvert
je copie le répertoire du zip \styles evec son fichier gt.css
cela donne ...\WebServerExtensions\www\eplotespvert\styles
dans le répertoire ..\WebServerExtensions\www\eplotespvert
je copie le fichier utilityfunctions.php sans modifier une ligne

et voila, j'associe un bouton dans studio avec lien url au fichier ../eplotespvert/plot/plotmain.php dans une nouvelle fenêtre

et j'ai ma fonction eplot en dwf et le luxe avec le choix des échelles et de ma presentation d'impression

Pièce jointe : un ZIP de mon répertoire eplotespvert modifié et une petite capture de la nouvelle fonction que je trouve très sympa wink

cordialement Jean-Marie

Dernière modification par Jean marie (Wed 26 September 2007 00:38)


Fichier(s) joint(s) :
Pour accéder aux fichiers vous devez vous inscrire.

Hors ligne

 

#4 Wed 26 September 2007 23:53

Gwenael Bachelot
Participant assidu
Lieu: Bureau Autodesk : Paris 12ème
Date d'inscription: 5 Sep 2005
Messages: 608
Site web

Re: [STUDIO 2007/2008 et Mapguide] fonction enregistrer sous en dwf

Jean marie a écrit:

Merci Gwenael
j'ai cherché sur ta piste et j'ai trouvé en utilisant le sample Sheboygan


Ca y est, tu es le roi du PHP ;-)

Merci beaucoup de faire partager le résultat de tes recherches.

Cordialement,
Gwenael

Hors ligne

 

#5 Fri 28 September 2007 10:29

Jean marie
Participant assidu
Lieu: Moissy Cramayel
Date d'inscription: 15 Feb 2007
Messages: 309
Site web

Re: [STUDIO 2007/2008 et Mapguide] fonction enregistrer sous en dwf

bonjour
donc voila les même scripts mais avec les menus en français et un petit bouton en plus pour fermer la fenêtre popup ... wink je bidouille ...

voila voila ....

pj fichier plot.zip à "dézipper" dans le même repertoire plot ../eplotespvert/plot/
et un petite capture
cordialement Jean-Marie

Dernière modification par Jean marie (Fri 28 September 2007 10:33)


Fichier(s) joint(s) :
Pour accéder aux fichiers vous devez vous inscrire.

Hors ligne

 

#6 Mon 29 October 2007 23:37

Jean marie
Participant assidu
Lieu: Moissy Cramayel
Date d'inscription: 15 Feb 2007
Messages: 309
Site web

Re: [STUDIO 2007/2008 et Mapguide] fonction enregistrer sous en dwf

bonjour
pour mieux illustrer la fonction ci joint une petite vidéo pour vous monter
son fonctionnement dans MapGuide

cordialement Jean-Marie 

[youtube]929B3a4LOQE[/youtube] = http://www.youtube.com/watch?v=929B3a4LOQE

Hors ligne

 

#7 Fri 03 October 2008 17:13

Muller Julien
Juste Inscrit !
Date d'inscription: 1 Sep 2007
Messages: 2

Re: [STUDIO 2007/2008 et Mapguide] fonction enregistrer sous en dwf

Bonjour,
Aurais tu une idée en .net?
Car cela ne marche pas....
Merci d'avance.

Hors ligne

 

#8 Fri 03 October 2008 21:13

Gwenael Bachelot
Participant assidu
Lieu: Bureau Autodesk : Paris 12ème
Date d'inscription: 5 Sep 2005
Messages: 608
Site web

Re: [STUDIO 2007/2008 et Mapguide] fonction enregistrer sous en dwf

Bonsoir,

Qu'est ce qui ne fonctionne pas en .Net ?

Le même exemple Sheboygan est disponible aussi en .Net, et, de mémoire, il fournit les mêmes fonctionnalités.

Cordialement,
Gwenael

Hors ligne

 

Pied de page des forums

Powered by FluxBB