Esempio n. 1
0
    public void setup(int astId)
    {
        var data = Table_asterism_ast.getInstance().getData(astId - 1);

        nameJp_.text = data.jpName_;
        nameEn_.text = data.name_;
    }
Esempio n. 2
0
    // 星座Idからデータ取得
    static public Asterism getData(int astId)
    {
        if (astId < 1 || astId > 89)
        {
            return(null);
        }

        var data     = new Asterism();
        int astIndex = astId - 1;

        var ast = Table_asterism_ast.getInstance().getData(astIndex);

        data.id_        = astId;
        data.shortName_ = ast.shortName_;
        data.name_      = ast.name_;
        data.jpName_    = ast.jpName_;
        var posTable     = Table_asterism_star_pos.getInstance();
        var lineHipTable = Table_asterism_line_hip.getInstance();
        var starHipTable = Table_asterism_star_hip.getInstance();

        // 恒星
        var starHipIndices = lineHipTable.getStarHipIndicesFromShortName(data.shortName_);

        data.starNum_ = starHipIndices.Count;
        foreach (var i in starHipIndices)
        {
            // ヒッパルコスIdに対応する恒星データを取得
            Star star    = new Star();
            var  posData = posTable.getDataFromHipId(i);
            star.hipId_     = i;
            star.magnitude_ = posData.magnitude_;
            star.name_      = starHipTable.getName(star.hipId_);
            star.pos_       = new Vector2(posData.lat_, posData.long_);
            star.color_     = new Vector3(posData.r_, posData.g_, posData.b_);
            data.stars_.Add(star);
        }

        // 恒星間ライン
        var linePair = lineHipTable.getLinesFromShortName(data.shortName_);

        foreach (var pair in linePair)
        {
            var line  = new Line();
            var start = posTable.getDataFromHipId(pair.startHipId_);
            var end   = posTable.getDataFromHipId(pair.endHipId_);
            line.start_      = new Vector2(start.lat_, start.long_);
            line.end_        = new Vector2(end.lat_, end.long_);
            line.startHipId_ = pair.startHipId_;
            line.endHipId_   = pair.endHipId_;
            data.lines_.Add(line);
        }

        return(data);
    }