Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 00e4dbd184a8eecfc8921431fcd1ecc2f966177e authored by Sanmisan on 13 October 2023, 20:18:23 UTC, committed by GitHub on 13 October 2023, 20:18:23 UTC
Update README.md
teaser img
1 parent b49b4e1
  • Files
  • Changes
  • ba30466
  • /
  • src
  • /
  • components
  • /
  • mapLinter
  • /
  • index.js
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:00e4dbd184a8eecfc8921431fcd1ecc2f966177e
directory badge
swh:1:dir:d0f70c56fb911ccedd47d48a8d54285cd62c650e
content badge
swh:1:cnt:41139677030d961b33aec4debd1d2b3073492848

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
index.js
import {Component} from "react";
import '../../styles/MapLinter.css';
import {Card, Divider, Row, Col, Empty} from 'antd';
import MapGenerator from "./mapGenerator";
import MainMapHistogram from "./mainMapHist";

class MapLinter extends Component {
    constructor(props){
        super(props);
        this.state = {
            propsSpec: null,
            selectedRawCase: null,
            selectedCaseData: null
        };
    }

    componentDidMount() {
        if(this.state.selectedRawCase === null){
            this.setState({
                propsSpec: this.props.vegaLiteSpec,
                selectedRawCase: this.props.selectRawCase,
                selectedCaseData: this.props.selectedCaseData
            });
        }else if(this.state.selectedRawCase !== this.props.selectRawCase){ //when user select a new case
            let selectRawCase = this.props.selectRawCase;
            this.setState({
                propsSpec: this.props.vegaLiteSpec,
                selectedRawCase: this.props.selectRawCase,
                selectedCaseData: this.props.selectedCaseData
            });
        } 
    }

    componentWillReceiveProps(nextProps, nextContext){
        if(this.state.selectedRawCase === null){
            let selectRawCase = nextProps.selectRawCase;
            this.setState({
                propsSpec: nextProps.vegaLiteSpec,
                selectedRawCase: selectRawCase,
                selectedCaseData: nextProps.selectedCaseData
            });
            
        }else if(this.state.selectedRawCase !== nextProps.selectRawCase){ //when user select a new case
            let selectRawCase = nextProps.selectRawCase;
            this.setState({
                propsSpec: nextProps.vegaLiteSpec,
                selectedRawCase: selectRawCase,
                selectedCaseData: nextProps.selectedCaseData
            });
            
        }
    }

    /** render components */
    /** TODO: should add the vis design between two maps */
    render(){
        let hasHardRuleViolation = this.props.hasHardRuleViolation;
        //console.log(hasHardRuleViolation);
        if(hasHardRuleViolation){
            return(
                <Card
                    size='small'
                    className='cardDetail'
                    style={{height: 500}}
                >
                    <Empty
                        style={{marginTop: 120}}
                        description={
                            <span>Please run the VEGA sript again
                            after fixing the invalid scripts</span>
                        }
                    />
                </Card>
            );
        }else{
            return(
                <Card
                    title='Original Choropleth Map'
                    size='small'
                    className='cardDetail'
                    style={{height: 550}}
                >
                    <MapGenerator
                        selectedCaseData={this.state.selectedCaseData}
                        vegaLiteSpec={this.state.propsSpec}
                        selectRawCase={this.state.selectedRawCase}
                        onVegaParseError={this.props.onVegaParseError}
                        state_shipment={this.props.state_shipment}
                    />
                    
                    <Divider
                        style={{marginTop: 5, marginBottom: 5}}
                    />
    
                    <MainMapHistogram
                        selectedCaseData={this.state.selectedCaseData}
                        vegaLiteSpec={this.state.propsSpec}
                        state_shipment_features={this.props.state_shipment_features}
                    />
                    
                </Card>
            );
        }
    }
}
export default MapLinter;
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API